I've made java desktop application,swing gui in netbeans and it works in netbeans but I have 2 problems:

1. I cant export working jar or class files

2. I need to run and build it from cmd line in windows xp


I guess that I need to include something in classpath...

when I run dist\app.jar it gives me "cannot find main class" and it's there in manifest file,i opened it and saw it

I've included libraries in dist\lib folder in build

my enviroment is ok,because all other "java program" work,only the programs with swing gui's made in designers in netbeans or eclipse wont work

offcourse app is running when I press run in netbeans

here is classpath debugged in netbeans:

C:\Program Files\NetBeans 6.9.1\java\modules\ext\appframework-1.0.3.jar;
C:\Program Files\NetBeans 6.9.1\java\modules\ext\swing-worker-1.1.jar;
C:\Program Files\NetBeans 6.9.1\java\modules\ext\beansbinding-1.2.1.jar;
C:\Documents and Settings\moje ime\Desktop\DesktopApplication1\build\classes;
C:\Documents and Settings\moje ime\Desktop\DesktopApplication1\src

here is netbeans project http://uppit.com/vig6cthngome/DesktopApplication1.rar

Recommended Answers

All 5 Replies

right mouse click onto project -> properties -> run -> mainclass

I have main class selected

here is the manifest file

Manifest-Version: 1.0
Ant-Version: Apache Ant 1.8.1
Created-By: 1.6.0_10-rc2-b32 (Sun Microsystems Inc.)
Main-Class: desktopapplication1.DesktopApplication1
Class-Path: lib/appframework-1.0.3.jar lib/swing-worker-1.1.jar lib/be
ansbinding-1.2.1.jar lib/lib
X-COMMENT: Main-Class will be added automatically by build

desktop application are integrated into Netbeans, there isn't anything to change manually, nor manifest file, everyithing in Netbeans is quasi "automaticaly" (comparing to other IDE)

be sure that just create new project, write code, compile, run from anywhere and anytimes, no handMade after complilations isn't required...

please reads tutorial on Netbeans.org about DeskTop Aplication (JSR296)

I've attached project in my first post, open that project,build jar and you'll see that jar wont work, while program works in netbeans.

no one going to download any file from net, I'm sorry, me too, again Neatbeans sites contains tons of tutorials, pick some similair and follows...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.