• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

Exam prep: ide or command line

 
Ranch Hand
Posts: 294
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi everyone,

I was reading the exam objectives on the Sun website and I stumbled across a topic about command line. Can anyone provide some insight if knowing command line options is something not to overlook? If so, are there runtime and/or compile options to watch out for?

I'm pretty much using Eclipse for all of my prep work, but am no stranger to a dos or shell prompt.

Aloha,
Doug
 
Sheriff
Posts: 11343
Mac Safari Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Doug Slattery:
...I'm pretty much using Eclipse for all of my prep work...


The SCJP exam is not concerned with how Eclipse handles code. You need to be familiar with the command line tools.
 
Ranch Hand
Posts: 1274
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Aloha oe,

exam seems to have a couple of questions concerning the use of
javac -d ...
for setting the directory where to put the class files in,
javac -cp ... or
javac -classpath ...
for the tricky classpath questions
javac -source 1.4 if you want your class to run in a 1.4 runtime environment
and perhaps
javac -Xlint:unchecked ...
to see in what line a warning (e.g. for the generics stuff) occured.



and for running I think only
java -ea (or -da) for the enabling and disabling of assertions.



So for all these questions, you should have some training without eclipse.
The topics above are all in the K&B book.


Yours,
Bu.
(Hamburg, raining again, but no eruptions so far)
[ September 17, 2007: Message edited by: Burkhard Hassel ]
 
marc weber
Sheriff
Posts: 11343
Mac Safari Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Also, aren't there situations in which javac hits compilation errors, but Eclipse just generates warnings? Since a lot of exam questions ask whether given code will compile, this might be a problem.
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Marc, I don't think there are situations where javac would give an error, but Eclipse would only give a warning.

A program with an error in the Java code remains an uncompilable program, doesn't matter if you compile it with javac or with another compiler. It would be really strange if you could write a program that cannot be compiled with javac, but can be compiled with Eclipse.

Do you have a specific example to demonstrate a situation where Eclipse would only give a warning while javac would give an error?
 
Doug Slattery
Ranch Hand
Posts: 294
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Mahalo (Thanks) for your responses.

Obviously, I haven't gotten far enough into the book yet for the command line objective. Since it's in there, I'm not going to sweat it too much for now.

As far as Java generating errors where Eclipse may generate warnings, my understanding is Eclipse is a (glorified?) front end for the command line compiler. It may use an api in the jdk somewhere, but I would expect that if a compile failed, Eclipse would act appropriately. It will though, ask if you want to run the program anyway upon compile errors when trying to run an uncompiled program.

Aloha,
Doug
 
marc weber
Sheriff
Posts: 11343
Mac Safari Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Jesper Young:
...It would be really strange if you could write a program that cannot be compiled with javac, but can be compiled with Eclipse...


Yes, it would be really strange. And I'm not certain about this, which is why I phrased it as a question.

What I recall is something about Eclipse compiling certain types of code using generics that actually fails (not just generates warnings) using javac. I did some searching, but couldn't find any examples, so hopefully I'm wrong.
 
Ranch Hand
Posts: 178
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Doug Slattery:
Hi everyone,

I was reading the exam objectives on the Sun website and I stumbled across a topic about command line. Can anyone provide some insight if knowing command line options is something not to overlook? If so, are there runtime and/or compile options to watch out for?

I'm pretty much using Eclipse for all of my prep work, but am no stranger to a dos or shell prompt.

Aloha,
Doug




you only need to know a few things about the command line. how to pass arguments into 'main', assertions, and java/javac (with/wo packages). I think that's all.

other than knowing that, i'd keep using your IDE for normal use, and just make sure you know those few things for the test.
 
Author
Posts: 84
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
From what I understand, the SCJP exam doesn't offer auto-complete like an IDE

I have gone through some of my exam prep with Eclipse for ease of noodling and experimentation, but I will probably spend a bit of time at the command line making sure I remember some of the critical API signatures from memory, instead of ctrl-space.

@Marc, I have focused a lot on generics and although javac tends to give very different (and IMHO less clear) errors, I haven't been able to come up with an example yet that will not compile in javac and will compile in Eclipse. But that's just me
 
marc weber
Sheriff
Posts: 11343
Mac Safari Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Peter Mularien:
...@Marc, I have focused a lot on generics and although javac tends to give very different (and IMHO less clear) errors, I haven't been able to come up with an example yet that will not compile in javac and will compile in Eclipse. But that's just me


That's good to hear! I haven't used Eclipse much, so a lot of what I "know" about it is second-hand information. I do like the clarity Eclipse's error messages.

It seems you have a better grasp of these issues than a lot of exam candidates, so I think you'll be fine.
 
Jesper de Jong
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Doug Slattery:
As far as Java generating errors where Eclipse may generate warnings, my understanding is Eclipse is a (glorified?) front end for the command line compiler. It may use an api in the jdk somewhere, ...


No, Eclipse is not a fancy front-end to javac, and it does not call javac via some API in the JDK. Eclipse has its own built-in compiler which is based on IBM's Java compiler named Jikes (Eclipse itself was originally developed by IBM). So Eclipse's compiler is different, but ofcourse it should comply to the Java Language Specification, so whatever the JLS says is an error, the Eclipse compiler must report as an error.

Ofcourse there could be small differences in what the Eclipse compiler says and what javac says, but if that's the case, it's probably because of a bug in one of the compilers or because the JLS doesn't unambiguously define what the compiler should do in that situation.
 
arch rival
Posts: 2813
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Beware of the subtle differences between the results of running through eclipse and the command line JDK. e.g. the following code executes without a warning in the console in eclipse (it does highlight an issue in the editor however). In the JDK you get a very stark command line warning, though again the .class file is generated.

package com.examulator;
import java.util.*;
public class Leader{
public static void main(String argv[]){
new Leader();
}
Leader(){
Vector <String> name = new Vector();
name.add("tony");
name.add("mike");
name.add("charles");
//here
for(String element : name){
System.out.print(element);
}
}
}
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic