• Post Reply Bookmark Topic Watch Topic
  • New Topic

Can't compile a simple class - import error for com.sun.deply.config.Config  RSS feed

 
Dave Shupe
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why can't I compile a class that imports com.sun.deploy.config.Config ?

Here's the error:
C:\Users\xxxxx.xxxxx\Desktop\java mixedCode issue>javac SetMixedCode.java
SetMixedCode.java:1: package com.sun.deploy.config does not exist
import com.sun.deploy.config.Config;

Here are my environment variables (windows 7) :

CLASSPATH = c:\Program Files\Java\jre6\lib

JAVA_HOME = C:\Program Files\Java\jdk1.6.0_43

PATH = ...;c:\Program Files\Java\jdk1.6.0_43\bin

Thanks! Hope this is a really easy one. I am a total Java noob....
 
Tony Docherty
Bartender
Posts: 3271
82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why can't I compile a class that imports com.sun.deploy.config.Config

The class is in deploy.jar so will have to add this jar to your classpath.

BTW You generally shouldn't be trying to import com.sun packages - they are not considered to be part of the public API of the jdk and there's no guarantee they will not change arbitrarily from one version of Java to the next.
 
Tony Docherty
Bartender
Posts: 3271
82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And welcome to the Ranch
 
Dave Shupe
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tony,
Thanks! I was able to figure out what I was doing wrong from the auto threads that appeared, and from what you wrote. I needed to compile and run the class with an explicit classpath. I was developing a quick little class to patch a little problem at work. Thanks again so much, this was great!
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!