Author Topic: Java gurus, need help  (Read 528 times)

Offline -ammo-

  • Platinum Member
  • ******
  • Posts: 5124
Java gurus, need help
« on: March 24, 2003, 10:37:51 PM »
Just started my introduction to java course (CS151 here at the university) and I already have a problem.  The software the school provides to create, compile, and run java programs is textpad and Jbuilder6.  WHile it works just fine on the PC's at the university l;ab, it will not compile on my PC. Mind you its the same simple program that I built per the course instruction.  Can someone turn me on too a good windows based java compiling software?

TIA
Commanding Officer, 56 Fighter Group
Retired USAF - 1988 - 2011

Offline Pei

  • Silver Member
  • ****
  • Posts: 1903
Java gurus, need help
« Reply #1 on: March 24, 2003, 11:22:33 PM »
All you need to compile is to install a JDK: download one for your OS from http://java.sun.com/j2se/downloads.html

You'll need to know which version you are using at school.

Once you have installed then you should be able to run javac (of course you'll need to set your CLASSPATH so it can find the source code: see the documentation).

If you are looking for an IDE (integrated development environment such as JBuilder) you can get a couple of good free ones:
NetBeans: http://www.netbeans.org/
Eclipse: http://www.eclipse.org

I would recommend figuring out how to compile your code from the command line using javac since if you don't understand how to compile (i.e. you always rely on an IDE) you will have difficulty finding compile problems.

If you are still having problems post here with details and I will try and help.

Offline Erlkonig

  • Nickel Member
  • ***
  • Posts: 564
Java gurus, need help
« Reply #2 on: March 25, 2003, 01:20:33 AM »
I don't anything about Javabuilder or the other IDE's, but like Pei said you'll need the JDK at the very least.   I used  emacs w/ the Java Developing Environment for Emacs (JDEE) for Java work in Windows, but those have a fairly involved installation process.  You can impress the nerds in your class if you mention you use it, though.

Offline jonnyb

  • Nickel Member
  • ***
  • Posts: 593
Java gurus, need help
« Reply #3 on: March 25, 2003, 11:16:48 AM »
If you really have some need to use an IDE, you can use Sun's Studio (used to be Forte).  Personally, I use IntelliJ, but it is not a freebie.  Of course, for the majority of java you'll be developing in an intro course, notepad will be fine.  If you REALLY want to impress the nerds, download and install cygwin.  It's a unix emulator for windows.  Then use vi to develop your code.

Quick rundown:

1) download and install the latest jdk from http://java.sun.com
2) set your PATH environment variable to be x:\path\to\jdk\bin where x is the drive you installed the jdk
3) test it by opening a dos window and typing javac -help.
4) open notepad
5) type the following test class in:

public class Hello {
  public static void main (String[] args) {
    System.out.println("Hello World");
    System.exit(0);
  }
}

6) Save that as Hello.java
7) Compile it with: javac -classpath . Hello.java
8) run it with: java -classpath . Hello
9) If you see Hello World, you've successfully installed the jdk on your pc.
« Last Edit: March 25, 2003, 11:20:24 AM by jonnyb »

Offline Mickey1992

  • Gold Member
  • *****
  • Posts: 3362
Java gurus, need help
« Reply #4 on: March 25, 2003, 11:41:42 AM »
As Pei said, learning to use javac from a DOS prompt is a necessity.  Chances are your future employer will not use the same IDE that you use in class.

That said, having experience with Eclipse looks good on a resume. :)

Offline air_guard

  • Nickel Member
  • ***
  • Posts: 380
Java gurus, need help
« Reply #5 on: March 25, 2003, 11:48:07 AM »
Have you tried linux they have all the c++,sql and java devolopment tools inbuilt (or for free download).
It is a good tool if youre a student and better its free :), I started to use it while ago and seems to lean on that platform for proffesional use now.

games ofcourse has to be done from MS :D
« Last Edit: March 25, 2003, 11:51:07 AM by air_guard »

Offline -ammo-

  • Platinum Member
  • ******
  • Posts: 5124
Java gurus, need help
« Reply #6 on: March 25, 2003, 11:29:10 PM »
I just want to say that I appreciate the responses.  I figured out my problem.  Photoshop which was instaled on my machine had created its own CLASSPATH variable and it conflicted with the one I created to point to the source code.  Photoshop is gone for now, and so is my problem.

Pei, given that, I want to be able to compile and run java from a DOS prompt.  Can you explain in detail how I  go about it?  at the prompt (changed the directory to where the java files reside) I typed javac and hit enter  What I got back from the PC was

C:\savitch>javac FirstProgram
javac: invalid argument: FirstProgram
Usage: javac
where possible options include:
  -g                        Generate all debugging info
  -g:none                   Generate no debugging info
  -g:{lines,vars,source}    Generate only some debugging info
  -O                        Optimize; may hinder debugging or enlarge class file

  -nowarn                   Generate no warnings
  -verbose                  Output messages about what the compiler is doing
  -deprecation              Output source locations where deprecated APIs are us
ed
  -classpath         Specify where to find user class files
  -sourcepath        Specify where to find input source files
  -bootclasspath     Override location of bootstrap class files
  -extdirs           Override location of installed extensions
  -d            Specify where to place generated class files
  -encoding      Specify character encoding used by source files
  -target         Generate class files for specific VM version


What am I doing wrong?
Commanding Officer, 56 Fighter Group
Retired USAF - 1988 - 2011

Offline takeda

  • Nickel Member
  • ***
  • Posts: 514
Java gurus, need help
« Reply #7 on: March 26, 2003, 01:49:44 AM »
Try:
javac FirstProgram.java

If FirstProgram depends on classes on other files, just compile the whole bunch:
javac *.java

That classpath thingie gets really annoying as a beginner.

I have used every IDE around, and find that for me, they tend to get in the way more than help.
So ultraedit, javac and ant for me.
« Last Edit: March 26, 2003, 01:53:05 AM by takeda »

Offline jonnyb

  • Nickel Member
  • ***
  • Posts: 593
Java gurus, need help
« Reply #8 on: March 26, 2003, 02:22:40 AM »
ammo,

Do exactly as I described in my previous post.  This will get you up and running.  I code java for a living.  Any questions, feel free to email me at jonnyb1@cox.net.

Offline devious

  • Nickel Member
  • ***
  • Posts: 703
      • http://www.jg301-wildesau.de
Java gurus, need help
« Reply #9 on: March 26, 2003, 04:28:02 AM »
Quote
Originally posted by -ammo-
I typed javac and hit enter  What I got back from the PC was

C:\savitch>javac FirstProgram
javac: invalid argument: FirstProgram


What am I doing wrong?


You must supply the .java extension for the compiler to work.

Offline Duedel

  • Silver Member
  • ****
  • Posts: 1787
Java gurus, need help
« Reply #10 on: March 26, 2003, 04:37:40 AM »
Hey dtx wir brauchen in unserer Firma noch billiges Java Know-How. Haste nicht Lust .... :D

Offline devious

  • Nickel Member
  • ***
  • Posts: 703
      • http://www.jg301-wildesau.de
Java gurus, need help
« Reply #11 on: March 26, 2003, 06:15:24 AM »
Definiere "billig" ;)

Für Jobanfragen: wilboh@t-online.de

Offline -ammo-

  • Platinum Member
  • ******
  • Posts: 5124
Java gurus, need help
« Reply #12 on: March 26, 2003, 01:13:32 PM »
Johnny-

I will shoot off an e-mail tonight when I get home from work. Thx man.
Commanding Officer, 56 Fighter Group
Retired USAF - 1988 - 2011