User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Java section within the Software Development category of DaniWeb, a massive community of 425,819 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,031 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Java advertiser: Lunarpages Java Web Hosting
Views: 750 | Replies: 22
Reply
Join Date: Jun 2008
Location: WA, USA
Posts: 775
Reputation: Alex Edwards is a jewel in the rough Alex Edwards is a jewel in the rough Alex Edwards is a jewel in the rough 
Rep Power: 4
Solved Threads: 76
Alex Edwards's Avatar
Alex Edwards Alex Edwards is offline Offline
Master Poster

Re: New to Java

  #11  
Jul 10th, 2008
Originally Posted by bloody_ninja View Post
How odd. As I stated before,
I am using Java Eclipse SDK and within it says
-JRE System Library [jdk 1.5]-

and about 1/3 of the programs give me a compiler error. I talked to a programmer and my uncle's office and he said yeah, some things are different so it wont work out as the tutorial says.


You should upgrade.

I'll give you a link to my Instructor's website (via pm) - has all of the steps to upgrade to 6.0 in the event that you forget a step.
Reply With Quote  
Join Date: Jul 2008
Posts: 92
Reputation: bloody_ninja is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 1
bloody_ninja bloody_ninja is offline Offline
Junior Poster in Training

Re: New to Java

  #12  
Jul 11th, 2008
Interesting you should say that 1.6 is backwards compatible. I just talked with the programmer at work, and he said that in 1.5, they removed certain functions such as assert or format, but it was re-instituted in 1.6. He said the purpose of using 1.5 is because it is the most stable version right now, and every software related piece in the company runs off of 1.5

Now I am stuck, he told me to keep 1.5, but if I don't change it, I won't understand most of those online tutorials.
Reply With Quote  
Join Date: Feb 2006
Posts: 1,460
Reputation: masijade is just really nice masijade is just really nice masijade is just really nice masijade is just really nice masijade is just really nice 
Rep Power: 9
Solved Threads: 130
masijade's Avatar
masijade masijade is offline Offline
Nearly a Posting Virtuoso

Re: New to Java

  #13  
Jul 11th, 2008
Originally Posted by bloody_ninja View Post
How odd. As I stated before,
I am using Java Eclipse SDK and within it says
-JRE System Library [jdk 1.5]-

and about 1/3 of the programs give me a compiler error. I talked to a programmer and my uncle's office and he said yeah, some things are different so it wont work out as the tutorial says.


That is the runtime. Has nothing to do with the compilation. Eclipse has it's own compiler and you can set it to expect source from anywhere form 1.4 to 1.6.

Look at your preferences
Windows->Preferences Java->Compiler Compiler compliance level

And at your project properties
Project->Properties Java Compiler (if "Enable project specific settings" is checked) Compiler compliance level


The problems you listed above are actually caused by code for 1.5 or later being compiled at a 1.4 compliance level.
Java Programmer and Sun Systems Administrator

----------------------------------------------

Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.
--Brian Kernighan
Reply With Quote  
Join Date: Jul 2008
Posts: 92
Reputation: bloody_ninja is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 1
bloody_ninja bloody_ninja is offline Offline
Junior Poster in Training

Re: New to Java

  #14  
Jul 11th, 2008
So my compiler compliance level is 1.4

and for the second part under properties, "Enable project specific settings" is not checked off.

How do i resolve these problems and not get that compiler error when using programs from the Java Sun site??

-------------------------------------------------------------------------------------------------------------------
In addition, I was reading someone's post on how to create an instant messenger program, which lead me to this website

http://java.sun.com/developer/online...a2/socket.html

So I copied the scripts of Example 1 into my Java client, and the client script of example 1 did not work. I run it, and it opens for about 2 seconds, then closes, and the console says Unknown host: kq6py.eng

I don't think this is because of my compiler version or anything, because I didn't get any compiler errors.
Last edited by bloody_ninja : Jul 11th, 2008 at 2:28 am.
Reply With Quote  
Join Date: Jul 2008
Posts: 92
Reputation: bloody_ninja is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 1
bloody_ninja bloody_ninja is offline Offline
Junior Poster in Training

Re: New to Java

  #15  
Jul 11th, 2008
Oh yes, and it also says this is the compiler/interpreter commands to run the program. Exactly where to I insert or paste this? :

javac SocketServer.java
javac SocketClient.java

java SocketServer
java SocketClient
Reply With Quote  
Join Date: Feb 2006
Posts: 1,460
Reputation: masijade is just really nice masijade is just really nice masijade is just really nice masijade is just really nice masijade is just really nice 
Rep Power: 9
Solved Threads: 130
masijade's Avatar
masijade masijade is offline Offline
Nearly a Posting Virtuoso

Re: New to Java

  #16  
Jul 11th, 2008
Originally Posted by bloody_ninja View Post
So my compiler compliance level is 1.4

and for the second part under properties, "Enable project specific settings" is not checked off.

How do i resolve these problems and not get that compiler error when using programs from the Java Sun site??

Change the compiler compliance level to 5.0 or 6.0 (and, if you're version won't let you, upgrade Eclipse).

-------------------------------------------------------------------------------------------------------------------
In addition, I was reading someone's post on how to create an instant messenger program, which lead me to this website

http://java.sun.com/developer/online...a2/socket.html

So I copied the scripts of Example 1 into my Java client, and the client script of example 1 did not work. I run it, and it opens for about 2 seconds, then closes, and the console says Unknown host: kq6py.eng

I don't think this is because of my compiler version or anything, because I didn't get any compiler errors.


No, it's because you need to change the hostname referenced in the program. Your hostname is, seemingly, not kq6py.

You need to change
socket = new Socket("kq6py", 4321);
to
socket = new Socket("<your hostname or ip address>", 4321);
Java Programmer and Sun Systems Administrator

----------------------------------------------

Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.
--Brian Kernighan
Reply With Quote  
Join Date: Feb 2006
Posts: 1,460
Reputation: masijade is just really nice masijade is just really nice masijade is just really nice masijade is just really nice masijade is just really nice 
Rep Power: 9
Solved Threads: 130
masijade's Avatar
masijade masijade is offline Offline
Nearly a Posting Virtuoso

Re: New to Java

  #17  
Jul 11th, 2008
Originally Posted by bloody_ninja View Post
Oh yes, and it also says this is the compiler/interpreter commands to run the program. Exactly where to I insert or paste this? :

javac SocketServer.java
javac SocketClient.java

java SocketServer
java SocketClient


You don't, if you're using Eclipse for this. Eclipse has it's own compile and run functions (which you, hopefully, already know how to use).

You use those commands if you are compiling and running the things manually from the command line.
Java Programmer and Sun Systems Administrator

----------------------------------------------

Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.
--Brian Kernighan
Reply With Quote  
Join Date: Jul 2008
Posts: 92
Reputation: bloody_ninja is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 1
bloody_ninja bloody_ninja is offline Offline
Junior Poster in Training

Re: New to Java

  #18  
Jul 11th, 2008
Thanks, my previous problem was resolved. Now for the current one:

Okay, I fixed the IP adress problem, but now, the client window closes on me saying No I/O. I am still new to this, but I don't see the problem at all. I already have the server running.
Reply With Quote  
Join Date: Feb 2006
Posts: 1,460
Reputation: masijade is just really nice masijade is just really nice masijade is just really nice masijade is just really nice masijade is just really nice 
Rep Power: 9
Solved Threads: 130
masijade's Avatar
masijade masijade is offline Offline
Nearly a Posting Virtuoso

Re: New to Java

  #19  
Jul 11th, 2008
I'm not sure if you can run two programs from Eclipse at the same time. You're probably better off compiling and running these from the command line (one command shell per).
Java Programmer and Sun Systems Administrator

----------------------------------------------

Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.
--Brian Kernighan
Reply With Quote  
Join Date: Jul 2008
Posts: 92
Reputation: bloody_ninja is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 1
bloody_ninja bloody_ninja is offline Offline
Junior Poster in Training

Re: New to Java

  #20  
Jul 11th, 2008
By this, you mean running from command prompt? I tried doing it before, although it never actually worked for me. I would to as far as typing in dir and seeing my java files there, but when I type javac HelloWorldApp.java, it never ran.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb Java Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the Java Forum

All times are GMT -4. The time now is 4:12 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC