Find the answer to your Linux question:
Results 1 to 4 of 4
Hi, I'm trying to compile a simple helloworld on Knoppix 3.6. I get the following error when I run "gcc helloworld.java" or "gcc -x java helloworld.java" Can't find default package ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Dec 2003
    Posts
    3

    compiling java with gcc/gcj on knoppix 3.6


    Hi, I'm trying to compile a simple helloworld on Knoppix 3.6. I get the following error when I run "gcc helloworld.java" or "gcc -x java helloworld.java"

    Can't find default package 'java.lang' . Check the CLASSPATH environment variable and the access to the archives

    Does anyone have any idea of what I should set the classpath to?

  2. #2
    Just Joined!
    Join Date
    Sep 2004
    Location
    San Fran, CA USA
    Posts
    22
    Never used knoppix, are you sure classpath is installed?

    dpkg --list | grep classpath

  3. #3
    Linux Guru lakerdonald's Avatar
    Join Date
    Jun 2004
    Location
    St. Petersburg, FL
    Posts
    5,035
    CLASSPATH isn't an something that can be installed. CLASSPATH is an environment variable, and you set it to a path (/some/directory/here). I'd assume that in this case, CLASSPATH would be the path to the directory where your compiler keeps all of the builtin classes, but don't quote me. Though I am certain you can't "install" it, cos its a variable, not an app
    -lakerdonald

  4. $spacer_open
    $spacer_close
  5. #4
    Just Joined!
    Join Date
    Sep 2004
    Location
    San Fran, CA USA
    Posts
    22
    Sorry, let me clarify.

    classpath is indeed a gnu version of java libraries which can be installed. And if one did, of course all variables would be set properly.

    apt-cache show classpath

    Package: classpath
    Priority: optional
    Section: libs
    Installed-Size: 684
    Maintainer: John Leuner <jewel@debian.org>
    Architecture: i386
    Version: 2:0.10.1-2
    Depends: libgcj-common, libgtk2.0-0, libart-2.0-2, classpath-common (>= 2:0.10-1)
    Conflicts: libgcj3 (<= 1:3.2-0pre1)
    Filename: pool/main/c/classpath/classpath_0.10.1-2_i386.deb
    Size: 418538
    MD5sum: c8649a6f93956e160f17ee72de713ec5
    Description: GNU Classpath - clean room standard Java libraries
    Our goal is to provide a free replacement for Sun's proprietary class
    libraries so that the GNU system can run programs written in the Java
    language.
    .
    GNU Classpath makes it possible to compile DFSG-free programs written
    in the Java language without depending on proprietrary class libraries.
    .
    GNU Classpath can be used to run Java applications without depending on
    proprietary software.


    I just assumed he wasn't talking about sun's java b/c it is not installed in Knoppix, although didn't consider he may have installed it directly from sun and would have to set the variable himself.

    If that's the case, it is wherever the sun java package was installed (likely candidates being /opt/javaversion or /usr/javaversion of course)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •