aspose file tools*
The moose likes Beginning Java and the fly likes Just getting started, need help Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Just getting started, need help" Watch "Just getting started, need help" New topic
Author

Just getting started, need help

Jake Deed
Greenhorn

Joined: Dec 26, 2008
Posts: 2
Ok so ive installed the Java Development Kit and Runtime Environment and have set the path up correctly for javac.

I made MyFirstApp.java in a folder on my desktop called JAVA. Is this where i should be doing it?

Secondly when i do javac MyFirstApp.java no class file is created. Also when i drag my file onto the javac.exe no class file is created. or atleast i have no idea where it is being sent to.

Can someone please help me, would be much appreciated!
Juva Yuva
Greenhorn

Joined: Dec 18, 2008
Posts: 17
Did it thrown any error ? can you elaborate the output of javac as seen when executed
fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 11499
    
  16

1) you can put your .java files anywhere you want - it doesn't matter. it's a bad idea to mix your own .java/.class files with the ones that come with the JDK, but you're not doing that, so you're ok.

2) when you say you "do javac MyFirstApp.java", what DOES it do? tell us EXACTLY what it says. Where are you when you do it (i.e. what directory are you in, what EXACTLY is the command you type, etc). The more details you give, the easier it is to help. Otherwise, we're just kind of guessing.

3) When you say "when i drag my file..." WHAT file are you dragging?

Generally, java doesn't work by 'dragging a file onto the java.exe'. Once you get your .java file to compile into a .class file, you would then run something like the following:

java <classname>


So, if I wrote a class called HelloWorld.java, I would compile it with this:

javac HelloWorld.java


That should create a file called "HelloWorld.class" in the same directory with my HelloWorld.java file. I would then run

java HelloWorld


There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 40052
    
  28
You have, I am sure, found the Java Tutorials. That section includes instructions about how to execute your first ever program, and also a section about what commonly goes wrong.

And welcome to JavaRanch
Jake Deed
Greenhorn

Joined: Dec 26, 2008
Posts: 2
How do i get the screen to pause when i do javac MyFirstApp.java in run? it only flashes then dissapears. So i dont see any errors etc.
subhajit paul
Greenhorn

Joined: Dec 17, 2008
Posts: 17
type cmd in run prompt. when the shell opens, type javac <javafilename>.java.

the output/error messages will now be persistent. kindly read them carefully and post in details what error you are coming up with.
fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 11499
    
  16

Again, the DETAILS are critical. HOW ARE YOU RUNNING THIS? Are you using an IDE or not? The more details you can give, the easier and sooner someone can help you.

We can assume you are running some flavor of windows. Go to the start menu, and click on 'run'. in the box, type "cmd", then hit enter. Now, navigate to the directory where your .class file lives.

Once there, type "java <classfilename>".
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Just getting started, need help