日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

javac compiling error ( mising package)

發(fā)布時(shí)間:2023/12/9 编程问答 26 豆豆
生活随笔 收集整理的這篇文章主要介紹了 javac compiling error ( mising package) 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

javac 編譯java源文件時(shí),提示 package does not exist 的錯(cuò)誤

Test.java

import java.security.MessageDigest; import org.apache.commons.codec.binary.Hex;public class Test{public static void main(String args[]){boolean isAlarmed = true;boolean aa = isAlarmed || false;String queryTimestamp = "1970-01-01T00:00:00+0000";System.out.println(queryTimestamp.getBytes());try{MessageDigest md5 = MessageDigest.getInstance("MD5");System.out.println(md5.digest("stringtodigest".getBytes()));byte[] value = "stringtodigest".getBytes();md5.update(value);byte[] digest = md5.digest();System.out.println(new String(Hex.encodeHex(digest)));System.out.println(md5.digest("stringtodigest".getBytes())); System.out.println(md5.digest("stringtodigest".getBytes()));}catch(Exception e){ } } }

  javac Test.java編譯的時(shí)候報(bào)錯(cuò)!

解決辦法:

  1. 到mvn repository(http://mvnrepository.com/artifact/commons-codec/commons-codec/1.7)上面吧缺少的 jar 包下載下來,

  2. 然后給 CLASSPATH 環(huán)境變量在添加一下這個(gè)jar 包所在的路徑,就可以了。

---------------------------------------------------------------------------------------

參考:https://www.linuxquestions.org/questions/programming-9/javac-compiling-error-mising-package-669775/

javac compiling error ( mising package)

First i have to say I am very new to java. I downloaded java codes from the Internet and try to compile them using javac. I got following error,
Code:

  

C:\temp\javacrypt>"C:\Program Files\Java\jdk1.6.0_06\bin\javac" RSAExample.java .\BaseCrypto.java:1: package org.apache.commons.codec does not exist import org.apache.commons.codec.DecoderException;^ .\BaseCrypto.java:2: package org.apache.commons.codec.binary does not exist import org.apache.commons.codec.binary.Hex;^ .\BaseCrypto.java:26: cannot find symbol symbol : class DecoderException location: class BaseCryptopublic static byte[] asByte(String hexString) throws DecoderException {^ .\BaseCrypto.java:16: cannot find symbol symbol : variable Hex location: class BaseCryptoreturn new String(Hex.encodeHex(buf));^ .\BaseCrypto.java:27: cannot find symbol symbol : variable Hex location: class BaseCryptoreturn Hex.decodeHex(hexString.toCharArray());^ 5 errors

  I guess i just missed some packages like "org.apache.commons.codec.*",
  and that package is not part of standard jdk, right?

  How do i get those package? I also have netbean and eclipse, but I haven't tried to use them yet.

  -----------------

When you get the package, which is probably a .jar file, add that .jar file to your classpath (environment variable).

EDIT:?Specifically, here.

EDIT: I believe on Windows it's something like...

SET CLASSPATH=%CLASSPATH%;C:\path\to\jar\jarfile.jar

----------------------

I downloaded the jar file suggested by elprawn, and it work great!! thank you so much.
I am curious about the suggestion from jay73. Is the package management the software like "yum" or "apt-get", right? What keyword should use to search for it?

----------------------

On a system that uses apt, you can use?
aptitude search commons
and you'should get a list of the available commons?libraries.On?ubuntu:

jurgen@Selena:~$ aptitude search commons i libcommons-attributes-java - adds C#/.Net-style attributes to Java code i A libcommons-beanutils-java - utility for manipulating JavaBeans i libcommons-beanutils-java-doc - Javadoc API for libcommons-beanutils-java i A libcommons-cli-java - API for working with the command line argu i A libcommons-codec-java - encoder and decoders such as Base64 and he i A libcommons-collections-java - A set of abstract data type interfaces and i A libcommons-collections3-java - A set of abstract data type interfaces and i libcommons-collections3-java-do - Documentation for libcommons-collections3- i libcommons-configuration-java - Java based library providing a generic con p libcommons-csv-java - a Java library for working with csv (comma p libcommons-csv-java-doc - documentation for libcommons-csv-java i A libcommons-daemon-java - library to launch Java applications as dae i A libcommons-dbcp-java - Database Connection Pooling Services i A libcommons-digester-java - Rule based XML Java object mapping tool p libcommons-discovery-java - locates classes that implement a given Jav i A libcommons-el-java - Implementation of the JSP2.0 Expression La i libcommons-fileupload-java - File upload capability to your servlets an i libcommons-httpclient-java - A Java(TM) library for creating HTTP clien i libcommons-httpclient-java-doc - Documentation for libcommons-httpclient-ja i libcommons-io-java - Common useful IO related classes i libcommons-io-java-doc - Common useful IO related classes - documen p libcommons-jexl-java - expression language engine p libcommons-jxpath-java - manipulate javabean using XPath syntax p libcommons-jxpath-java-doc - Javadoc API for libcommons-jxpath-java i A libcommons-lang-java - Extension of the java.lang package i A libcommons-launcher-java - cross platform java application launcher i A libcommons-logging-java - commmon wrapper interface for several logg i A libcommons-modeler-java - convenience library to use Java Management i libcommons-modeler-java-doc - documentation and examples for Commons Mod i libcommons-net-java - internet protocol suite Java library p libcommons-openpgp-java - a common and simple interface for generati p libcommons-openpgp-java-doc - a common and simple interface for generati i A libcommons-pool-java - pooling implementation for Java objects i libcommons-validator-java - ease and speed development and maintenance p libgettext-commons-java - Java classes for internationalization (i18 p libhibernate-commons-annotation - Hibernate Commons Annotations p libws-commons-util-java - Common utilities from the Apache Web Servi p libxml-commons-resolver1.1-java - XML entity and URI resolver library p libxml-commons-resolver1.1-java - XML entity and URI resolver library -- doc p libxml-commons-resolver1.1-java - XML entity and URI resolver library -- nat i libxmlgraphics-commons-java - reusable components used by Batik and FOP

  

?

轉(zhuǎn)載于:https://www.cnblogs.com/oxspirt/p/7443485.html

總結(jié)

以上是生活随笔為你收集整理的javac compiling error ( mising package)的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。