0

try to compile a .java file into .class file with javac command in prompt. but I got the error, " package com.hp.hpl.jena.rdf.model*; not exist."

here is the command I am using:

javac -classpath /lib/* Sample2.java

which should load all .jars under folder of lib into classpath.

here is the code inside Sample2.java

import com.hp.hpl.jena.rdf.model.*;
public class Sample2 extends Object{
    public String name;

    public static String sayHello(String name) {
        Model model = ModelFactory.createDefaultModel();

        return "Hello, " + name + "!";
    }
}

How can I fix this problem, any help will be appreciate!

Simson
  • 13
  • 8
  • Are you on Windows or Linux? – morgano Sep 10 '14 at 06:33
  • the system is windows 7 – Simson Sep 10 '14 at 07:17
  • Similar question (if not duplicate): http://stackoverflow.com/q/1237093/. – Luke Woodward Sep 10 '14 at 07:41
  • no it doesn't work.Even if I list all the .jars I need, it still return the same thing to me. – Simson Sep 10 '14 at 07:46
  • On the jena users list the example given is -classpath /lib/*.jar. NB the .jar. – AndyS Sep 10 '14 at 09:20
  • I've tried -classpath /lib/*.jar also.Now I assume that there'er something wrong with my java version. – Simson Sep 10 '14 at 13:45
  • What version of the Jena libraries are you using? Starting with `2.12.0`, Java 7 is the minimum supported version. Additionally, you may need to remove the leading `/` and use `-classpath lib/*.jar`. – Rob Hall Sep 10 '14 at 16:14
  • Thank you,thank you,thank you,@Rob Hall.It is the wrong version I am using.Everything become lovely, after I switch to java 7.And lib/*.jar, or any other format, seems don't work.I put these jars into system environment variable "classpath". – Simson Sep 11 '14 at 04:01

1 Answers1

0

The problem has been solved.Thanks to Rad Hall. The command option -classpath or -cp seems don't work well on my system(win7 32bit).So I input all the jars I need into environment variable "classpath". Jena_2.12.0 needs jdk 1.7+, that is why I can't run my class which imports jena package,in my C++ project with jni. Thank you all for your help.

Simson
  • 13
  • 8