我是靠谱客的博主 鳗鱼绿草,最近开发中收集的这篇文章主要介绍java c 混合,在javac中混合--class-path和--module-path(JDK 9),觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

I tried to follow this question but it does`t work for me.

I want to compile 1 module (which does not requires any other module or jar) together with other classes which use this module and will be in unnamed module.

javac -cp lib* --module-path modules --add-modules simpleModule -d out @classes.txt

After I run this command I get " package org.... does not exist". But jar with this package is in lib directory

lib - directory with my libraries-jars

modules - this folder contains module "simpleModule" with module-info.java

@classes.txt - all list of classes to compile (including modular and non modular). OS - Windows

When I remove module-info.java from simpleModule everything compiles well.

解决方案

Old question, but I came across a related issue recently when working on a project using module and non-module jars. Based on your example command line, use the following command line if your module is in a jar:

javac -cp lib*.jar -d out @classes.txt

If the module is not in a jar, meaning exploded directory, this will be the command:

javac -cp modsmoduled.in.question -d out @classes.txt

I tested the above using JDK 11.0.1.

最后

以上就是鳗鱼绿草为你收集整理的java c 混合,在javac中混合--class-path和--module-path(JDK 9)的全部内容,希望文章能够帮你解决java c 混合,在javac中混合--class-path和--module-path(JDK 9)所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(66)

评论列表共有 0 条评论

立即
投稿
返回
顶部