Solved

Java Compiler

Posted on 2011-02-27
13
309 Views
Last Modified: 2012-05-11
I have installed a Java compiler.

Per installation instructions, it appears that the installation was successful.    The following snapshots/documents are attached:

1. "Instructions.jpg" -- according to the instructions, "long message" means success
2. "InstructionFeedback.jpg" -- I get this long message... I figure it was installed successfully
3. "HelloWord -- Instructions.pdf" -- per some website, it was recommended to test the installation via compiling the "Hello World" program...
4. Per #3, I followed the compiling of the Hello World program (page 5 of the PDF).   However, I don't get the ".class" file after typing "HelloWorld.java' (I renamed it from HelloWorldApp to HelloWorld).

What am I missing?

EEH


Installation.jpg
InstallationFeedback.jpg
HelloWord----Instructions.pdf
Java.jpg
0
Comment
Question by:ExpExchHelp
  • 9
  • 4
13 Comments
 
LVL 47

Expert Comment

by:for_yan
ID: 34992811
It looks that you have runtime environment but not jdk. You can run prigrams
with java command but cannot compile them with javac
0
 
LVL 47

Expert Comment

by:for_yan
ID: 34992831
This statement in your window that before you can run java program you need to have java compiler is not correct.
Before you can run you need to install Java Virtual Machine (they can also call it Java Runtime Environmen)
- the  command java corresponds to that.

If you want to write new programs then you need first to compile  - for that you need to have "javac" command which converts
.java file to .class file. if you already have a .claas fie or a .jar file you don't need to compile.

What I see is that after your installation "java" command is wroking, javac is not -  so probabley you installed
Java Runtime Environemnt (JRE) but not Java Development Environment (JDK).

So you fisrt need tio decide what you need - just to run java programs written by others or you also want to write new java programs of your own
and then install what you need accordingly - JRE or JDK
0
 

Author Comment

by:ExpExchHelp
ID: 34992905
for_yan:

I will have to write new programs as well...

What do I need to download/install?  
Do you have a recommendation for a website (for downloading the required software/components?  
If so, do I need to uninstall the current program for proper installation sequence?

EEH
0
 
LVL 47

Expert Comment

by:for_yan
ID: 34992920
It is all on the same web page, but make sure you install JDK, not JRE:

http://www.oracle.com/technetwork/java/javase/downloads/index.html

0
 
LVL 47

Expert Comment

by:for_yan
ID: 34992928
You can uninstall just for cleanliness.
In general I guess same version of JDK should install over JRE -
itshould complain if it does not
0
 

Author Comment

by:ExpExchHelp
ID: 34992994
Hmh... that's the same site I when to yesterday.

And, yes, I did install the JDK... not the JRE.   See snapshot (from yesterday's installation).

So, something else must be causing the problem.

Any additional recommendations?

EEH


jdk.jpg
0
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 
LVL 47

Expert Comment

by:for_yan
ID: 34993043
Go into bin --> you should have javac.exe in there

then go to you command prompt and type PATH and find first place where
you have jdk.../bin  or jre.../bin in there.

It may well be that you have your installation on your computer but don't have right PATH
 it in your environement, but you have some JRE from the old time in your ebviroemnt,
therefore java works but javac does noot

0
 
LVL 47

Expert Comment

by:for_yan
ID: 34993049
Also type java -version
and compare is it the same version which you downloaded and installed today
0
 
LVL 47

Expert Comment

by:for_yan
ID: 34993076
And ultmately go to control panel --> system -> advanced tab -> envirinement varaibales
and make sure that in the PTH varaiable the first java you encounter should point to
bin under your recent installation folder something like ...\jdk1.6.0_24\bin - it should come before any other java
in your path
0
 
LVL 47

Accepted Solution

by:
for_yan earned 500 total points
ID: 34993093
I meant of course "PATH" variable or it may be "Path" - it is case insensitve on Windows
If it points to installation of JDK and not to installation of JRE (which may have been on your computer before)
then both java and javac should work from the command prompt and should use the same version of java.

After you change Environemnt in cpntol panel - start new CMD window and check that correct PATH is there.
Then it should work
0
 

Author Comment

by:ExpExchHelp
ID: 34993198
for_yan:

The "devil is in the detail"....  thanks, that did it.

Even though I had added the directory to the systems environment variables, I had called it "java' not "PATH".

Once I changed that, it successfully created the class file.

Thanks again!!

EEH
0
 

Author Closing Comment

by:ExpExchHelp
ID: 34993199
Excellent solution
0
 
LVL 47

Expert Comment

by:for_yan
ID: 34993237
You are always welcome
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
mergeTwo  challenge 13 72
changePi Challenge 15 76
array220 challenge 8 47
unix in java example 9 43
INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now