1

I need to make a GUI Application for my class , so I want to make sure I can transfer a netbeans project using the GUI Builder (I know how to make it without it, but that's more time consuming and I think it would look neater without me guessing coordinates etc. and I was use to the netbeans GUI builder) from netbeans onto unix and compile it. So here's what I did I made a new JFrame form (using netbeans GUI Builder) called StartFrame.java and another called MenuFrame.java. (keep in mind that it ran with no errors in netbeans) StartFrame creates a new instance of MenuFrame and opens it on it's first run. So I transferred all of it onto the unix system. So at first I tried compiling it, but of course it got errors, saying that org.jdesktop... isn't found.
Okay so I've already searched stackoverflow and the web for this. So I ended up getting the swing-layout-1.0.4.jar from the libraries in netbeans. I'm kind of new at compiling from command line, but I put them all in the same folder, and while I was in that directory. I did

javac StartFrame.java -cp swing-layout-1.0.4.jar

and I got the error that NoClassDefFoundException: MenuFrame even though it is in the same folder. So then I tried

javac StartFrame.java MenuFrame.java -cp swing-layout-1.0.4.jar

and it compiled fine with no errors. So then It created 6 files StartFrame.class StartFrame$1.class StartFrame$2.class StartFrame$3.class StartFrame$4.class MenuFrame.class I tried running it with

java -cp swing-layout-1.0.4.jar StartFrame

and it had a NoClassDefFoundException: StartFrame. I searched the web for fixes for this and stack overflow and found similar (not exact though) problems like this, but none of those fixed it.

1
  • 1
    is there a package statement in StartFrame.java and/or MenuFrame.java? Commented Jul 2, 2011 at 16:26

1 Answer 1

1

The file dist/README.TXT will tell you how to proceed. Type ant -p at the command line to see that available commands: ant run is usually good.

Addendum:

The machine doesn't have ant installed

That would be unusual, so you should certainly verify it. You may need to add the current directory to the path, e.g.

java -cp .:swing-layout-1.0.4.jar StartFrame
Sign up to request clarification or add additional context in comments.

4 Comments

It only gives you instructions for running the already,netbeans built jar though, It doesn't say how to actually compile it correctly in unix, and run it without an executable.
That's where the ant -p comes in. Of course, the destination host must have a JDK to compile your code and a JRE to run it. I move NetBeans projects among disparate platforms routinely.
Is there any way to use java/javac to do it? the machine doesn't have ant installed and it belongs to the school.
oh wow thanks a lot, adding the current directory to the path worked. I didn't think you would need to do that since for javac it wasn't necessary. Now it runs fine.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.