• 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
  • Tim Cooke
  • paul wheaton
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

about accessing and importing from directory

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
//: appendixa:MutableInteger.java
// A changeable wrapper class.
import com.bruceeckel.simpletest.*;
import java.util.*;

class IntValue {
private int n;
public IntValue(int x) { n = x; }
public int getValue() { return n; }
public void setValue(int n) { this.n = n; }
public void increment() { n++; }
public String toString() { return Integer.toString(n); }
}

public class MutableInteger {
private static Test monitor = new Test();
public static void main(String[] args) {
List v = new ArrayList();
for(int i = 0; i < 10; i++)
v.add(new IntValue(i));
System.out.println(v);
for(int i = 0; i < v.size(); i++)
((IntValue)v.get(i)).increment();
System.out.println(v);
monitor.expect(new String[] {
"[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]",
"[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]"
});
}
} ///:~

Actually I have the bruceeckel source code in My Document and also the Java Documentation in the same My Document and each time I try to import from the Java documentation the program gets compiled while the import com.bruceeckel refuses to compile.I think may be this has to do with my classpath or path which I did not set right this is the classpath I set please help me to know how to access this
CLASSPATH:C:\MyJavaLib;C:\MyJavaLib\myutils.jar;C:\MyJavaLib\blackboxclasses.jar;
C:\Documents and Settings\User\My Documents\IntValue.java:15: class MutableInteger is coderanch, should be declared in a file named MutableInteger.java
public class MutableInteger {
^
C:\Documents and Settings\User\My Documents\IntValue.java:3: package com.bruceeckel.simpletest does not exist
import com.bruceeckel.simpletest.*;
^
C:\Documents and Settings\User\My Documents\IntValue.java:16: cannot find symbol
symbol : class Test
location: class MutableInteger
private static Test monitor = new Test();
^
C:\Documents and Settings\User\My Documents\IntValue.java:16: cannot find symbol
symbol : class Test
location: class MutableInteger
private static Test monitor = new Test();
^
Note: C:\Documents and Settings\User\My Documents\IntValue.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
4 errors

Tool completed with exit code 1
 
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
I think I answered this in your other post regarding the same issue. Please try that, and let us know if this resolves the problem.
 
reply
    Bookmark Topic Watch Topic
  • New Topic