2

I have to compile Prime.java this way:

javac –extdirs <path-to-appserver>/lib –Xlint Prime .java

in my case it looks like

C:\Users\Mateusz\workspace\zad2\WebContent\WEB-INF\classes> >javac -extdir <D:\xampp\tomcat>\lib -Xlint Prime.java

The response from cmd is "Access is denied."

How can I solve this ?

I set my path and java_path correctly.

Terry
  • 989
  • 8
  • 29

1 Answers1

1

Are you running the cmd as Administrator?

http://technet.microsoft.com/en-us/library/cc947813(v=ws.10).aspx

Do all the directories you affect exist and do you have write privileges for them?

EDIT:

You have to remote the "<" and ">" you are basically trying to write to a file. It should work like this:

javac -extdirs D:\xampp\tomcat>\lib -Xlint Prime.java 

EDIT2:

The parameter is "extdirs" not "extdir" (without "")

Alex
  • 58
  • 4
  • yes, I checked it twice. Also I change my directory from C:\ to D:\ in case of avoiding accesibility to C:\ – Jan Kowalski Oct 23 '14 at 17:55
  • C:\Users\Mateusz\workspace\zad2\WebContent\WEB-INF\classes>javac -extdir D:\xampp\tomcat>\lib -Xlint Prime.java – Alex Oct 23 '14 at 18:00
  • Here is the response `javac: invalid flag: -extdir Usage: javac ` – Jan Kowalski Oct 23 '14 at 18:02
  • Sorry, try it like this: C:\Users\Mateusz\workspace\zad2\WebContent\WEB-INF\classes>javac -extdirs D:\xampp\tomcat>\lib -Xlint Prime.java – Alex Oct 23 '14 at 18:07
  • Whoa! Amazing ammount of errors.. this in't good way.. Few examples: `Prime.java:2: error: package javax.servlet does not exist import javax.servlet.ServletException; ^ Prime.java:3: error: package javax.servlet.annotation does not exist import javax.servlet.annotation.WebServlet; ^ Prime.java:12: error: cannot find symbol public class Prime extends HttpServlet {` – Jan Kowalski Oct 23 '14 at 18:12
  • You need to add the depedencies to your classpath. Look at this question: http://stackoverflow.com/questions/9193228/compile-error-package-javax-servlet-does-not-exist – Alex Oct 23 '14 at 18:14
  • and how can I add many of them (imports) to classpath? also I want to ask what about this kind of error `Prime.java:12: error: cannot find symbol public class Prime extends HttpServlet {`? – Jan Kowalski Oct 23 '14 at 18:18
  • Actually, with the edits I did answer the question. As you stated I am not able to comment. @Jan It would be great if you could accept the answer, since it solved the original question the moment you got the compiling errors. – Alex Oct 23 '14 at 20:05