java - Run class in Jar file -


if have jar file called myjar.jar located in /myfolder , want use class called myclass it, how go doing command line?

i thought go directory , java -cp myjar.jar.myclass isn't working. appreciated.

use java -cp myjar.jar com.mypackage.myclass.

  1. if class not in package java -cp myjar.jar myclass.

  2. if not within directory myjar.jar located, can do:

    1. on unix or linux platforms:

      java -cp /location_of_jar/myjar.jar com.mypackage.myclass

    2. on windows:

      java -cp c:\location_of_jar\myjar.jar com.mypackage.myclass


Comments

Popular posts from this blog

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -