Help making a Pure Java app..

isolder

Registered
All I want to do is making a simple Java app. This is ALL the code to it:

import javax.swing.JOptionPane;

public class untitled {
public static void main(String[] args) {

JOptionPane.showMessageDialog(null, "Hey", "There", JOptionPane.INFORMATION_MESSAGE);
System.exit(0);
}
}




Using Project Builder in Jaguar..

If I make an Empty project and create a new Pure Java file within that project with the above code, that's all I should need to do right?

If I do it like that, it won't let me build at all. All the options to build or compile are dimmed out (unavailable).


If I instead make a new project that is a "Java Swing Application", it will make a whollle lotta files for resources and icons and applications in my project folder, AND a java file with all kinds of stuff I don't really know (I'm learning java atm).

If I put my code into THAT java file I can build and run.


Why can't I just make an empty project + pure java file and compile that?
 
i don't know why exactly, but i'm willing to bet it has something to do with setting up the target and executable stuff.

i may be wrong, but you would probably be better served to learn java without the help of an ide. in my experience it gives you a better idea the things an ide hides from you. just a thought.

if you do figure it out, let us know. i for one, and an xcode newbie so this seems like the sort of thing that would be helpful.
 
I still for the life of me can not figure out how to make a simple java app using Xcode. All I want to do is compile a .java source file. None of the template bologna or targets and executables..
 
Xcode provides a means to manage projects more complex than one or two source files, and aggregate products such as applications which include bundle resources, localized text, and other nifty stuff that makes OS X great.

An Xcode project requires 'targets' which tell it how to compile and build each product, and 'executables' which tell it how to debug them. You can add a 'Java Application' target to your empty project, then add your .java source to that target in order to compile. Since this approach is error-prone, especially for the novice, it's much safer to simply create a project from the 'Java Swing Application' template and replace the source with your own, as you have already done.

You can also compile the .java source from the Terminal, using the javac command, and run it using the java command. I'm not clear on the exact method, since I haven't used java in this way in a long time.
 
Targets and executable? Man.. guess it would be useful.. some time or another.

Guess I Will do it from the terminal from now..

Thanks for your input.
 
For Java development, I generally use Netbeans, as it is written in Java, and as such I'm already familiar with it because I got to use it on Windows and Linux.

You might want to try it out.
 
Back
Top