The Artima Developer Community
Sponsored Link

Java Answers Forum
Classpath problem with j2sdk142_nbide351

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Steve Schooler

Posts: 17
Nickname: zugzwang
Registered: Aug, 2004

Classpath problem with j2sdk142_nbide351 Posted: Nov 22, 2004 2:56 PM
Reply to this message Reply
Advertisement
Downloaded and installed j2sdk142_nbide351.  Started Sun's online swing tutorial
and detected problem with example 2:
 
    java.sun.com/docs/books/tutorial/uiswing/learn/example2.html
    
Ignoring netbeans app, I compile and run from console.  Example 2 contains:
 
    lookAndFeel = "com.sun.java.swing.plaf.motif.MotifLookAndFeel";    //  (1)
    lookAndFeel = "com.sun.java.swing.plaf.gtk.GTKLookAndFeel";        //  (2)
 
    try { 
        UIManager.setLookAndFeel(lookAndFeel); 
    } catch (ClassNotFoundException e) {
        ...
            
Without designating classpath, example 2 compiles and runs ok, even when
reference (1) above is invoked.  Invoking reference (2) above stalled until I:
 
1.  unzipped the ..\j2sdk142_nbide351\j2sdk1.4.2\src.zip source file
2.  added its path to the classpath
3.  added the -source 1.4 option to the javac command line (to avoid assert 
    messages).
4.  manually compiled GTKLookAndFeel.java to create GTKLookAndFeel.class
    BEFORE running the example.
    
This method results in the following compile message:
 
    Some input files use or override a deprecated API.  
    
QUESTIONS:
1.  Are the above steps 1-4 appropriate?  Would the classpath and deprecation
    problems have been resolved if I was using the net beans ide instead of the
    console?  Should I ignore the deprecation message, or does this mean I'm 
    still doing something wrong?
    
2.  Javac.exe takes significantly longer when the classpath includes the source
    files.  Is there anything that I can do about this? 
        
3.  Without a classpath, javac.exe is still able to process
 
        import java.util.*;
    
    How?  Are certain packages (somehow) imbedded into javac.exe for v1.4.2?
    If so, which ones?
    
4.  Similarly, why did UIManager.setLookAndFeel(lookAndFeel) work correctly
    without a classpath when
        
        lookAndFeel = "com.sun.java.swing.plaf.motif.MotifLookAndFeel";
    
    was invoked but not when
    
        lookAndFeel = "com.sun.java.swing.plaf.gtk.GTKLookAndFeel";
    
    was invoked.  Example 2 stalled until I manually compiled
    GTKLookAndFeel.java to create GTKLookAndFeel.class BEFORE running the
    example.  I infer that the
     
        UIManager.setLookAndFeel(lookAndFeel)
        
    requires that the *.class file pre-exist.  If I'm correct, why did
    
        UIManager.setLookAndFeel("...MotifLookAndFeel")
        
    work correctly WITHOUT a classpath, and WITHOUT first creating
    MotifLookAndFeel.class?

Topic: i  need your help ? Previous Topic   Next Topic Topic: Whats wrong with this java code! can anyone help?

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use