windows ant编译指定jdk

各位大神:
现在我需要在一台代码编译机器上,根据编译的不同系统指定不同的java_home及相关的lib。

        请问我如何才能做到(最好是在ant脚本中实现)。本人在网上找相关资料,然后自己各种实验,好几天了始终没能达到效果。求助

4个回答

target这些设过,不同的代码依赖的jdk及classpath不一样的问题。























本人在脚本javac的target,以及编译用到的classpath上试过N多试验貌似不起作用

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
更改Ant的JDK编译版本
 今天修改了以前的一个工程,用ant编译后放上去,发现运行报错,大体意思就是运行的版本号是多少,编译的版本号太高吧,估计是运行环境用的jdk的版本太旧引起的,类文件具有错误的版本 50.0,应为 49.0    50.0 对应的是JDK的1.6版本, 而49.0 对应的是JDK的1.5版本   修改方式就是myeclipse的编译环境到1.5以下 或者修改ant编译时的版本    ...
更改Ant的JDK编译版本
今天将写好的附件服务器的API发给同事 她引入我的jar后, 编译就会报错: 类文件具有错误的版本 50.0,应为 49.0 50.0 对应的是JDK的1.6版本, 而49.0 对应的是JDK的1.5版本 也就是说我的jar的版本高于她所用的版本 由于我们实际部署在1.5之上, 所以我就来修改我的编译环境 首先我先修改了Eclipse的编译环境到1.5, 但
在ant中,如何指定编译时使用的jdk?
ant版本1.6. jdk 有1.4.2 和1.3.1两个版本。rnrn设置java_home=1.4.2时,能运行ant,能编译源码。rn设置java_home=1.3.1时,ant运行报错如下:rnjava.lang.UnsupportedClassVersionError: com/sun/tools/javac/Main (Unsupported major.minor version 49.0)rnrnrnrn我想用1.3.1的jdk来编译我的源码,该怎么弄啊?
如何指定ant javac编译时用的jdk
我机器上默认装的时jdk1.6,但我希望运行ant javac进行编译时使用jdk1.4,我使用下面的语句进行编译是否有问题:rn rn rn
gradle指定相应JDK编译
问题描述:电脑中装有多个jdk版本,可能默认的jdk是1.6,但是项目中用到了俗称钻石语法的结构就是<>这玩意。但是由于你装的某些软件必须在1.6版本下才能跑,因此你不想更改的你的JAVA_HOME,下面有几种解决办法. IDEA编译器:比如Android studio.可以在File->Project structure->SDK Location中去指定你的jdk路径 build.gra
JBOSS 3&4指定jdk编译
由于公司的产品现在都基于JDK1.6编译,但是有些客户用的应用服务容器还是老版本 神马JBOSS3.2 之类的 ,部署上去容易出现编译不过的错误,所以必须对JBOSS 3 &amp;amp; 4 指定 JDK   找到 \%JBOSS_HOME%server\default\deploy\jbossweb-tomcat50.sar\conf\web.xml 在标签 servlet 添加如下 内容,如...
请教ant怎么编译jdk源码
比如我现在的jdk源码在D:\ProgramFiles\Java\jdk1.6.0_21,ant脚本如何写编译整个jdk源码!rn或是用javac命令如何编写??
Windows 7下JDK与Ant的安装和环境变量配置
Windows 7下JDK和Ant环境变量配置
如何使用Ant编译指定路径的Android
Ant如何去查找指定路径的build.xml并且编译
ant编译
ant编译
jdk和ant环境变量配置
jdk环境变量配置:   假定你的jdk安装在C:\Java\jdk1.6.0_03,windows2000/xp环境变量设置如下        JAVA_HOME=C:\Java\jdk1.6.0_03      PATH=%JAVA_HOME%\bin      CLASSPATH=.;%JAVA_HOME%/lib/dt.jar;%JAVA_HOME%/lib/tools.jar ...
windows下ant编译生成hadoop-eclipse-plugin插件解决办法
        我目前用的hadoop2.9.0版本,之前应该是用hadoop2.6以下的版本的时候,直接从网上下载hadoop-eclipse-plugin-**.jar拷贝到eclipse/plugins下就解决了,后面的版本看网上介绍需要用ant编译生成hadoop-eclipse-plugin-**.jar(**指版本号)文件,如果你在网上下载的jar包放到eclipse下不成功就自己编译...
安装JDK、ANT、JBOSS
1.        安装JDK 目的 操作 移动至安装路径 $mv jdk-6u37-linux-i586.bin /usr/local 执行安装 $./jdk-6u37-linux-i586.bin $vi /etc/profile 按i进入编辑模式新增如下内容 export JAVA_HOME=/usr/loc...
ant for windows
apache-ant-1.10.1-bin 第一步 解压apache-ant-1.7.1-bin.zip到某个盘符,这里以C盘做为例。 第二步 将bin所在目录设置为path环境变量的值之一:C:\apache-ant-1.7.1\bin 第三步 设置环境变量ANT_HOME为:C:\apache-ant-1.7.1 第四步 打开Dos窗口,输入ant -version检查是否正确,如果正确如下图
Maven编译源代码指定JDK版本
  &amp;lt;build&amp;gt;     &amp;lt;plugins&amp;gt;       &amp;lt;!-- 指定jdk,防止update project --&amp;gt;       &amp;lt;plugin&amp;gt;         &amp;lt;groupId&amp;gt;org.apache.maven.plugins&amp;lt;/groupId&amp;gt;         &amp;lt;artifactId&amp;gt;maven-co
maven 指定编码和编译和JDK版本
&lt;build&gt; &lt;finalName&gt;spirngMVC&lt;/finalName&gt; &lt;plugins&gt; &lt;!-- 编码和编译和JDK版本 --&gt; &lt;plugin&gt; &lt;groupId&gt;org.apache.maven.plugins&lt;/gr...
为Maven项目指定JDK编译版本
详细配置请参照官网说明maven-getting-start maven 默认的编译版本为jdk1.5,实际生产中我们用的编译版本至少都在1.6以上,所以我们需要为maven指定项目使用的jdk编译版本,实际上就是为maven配置插件maven-compiler-plugin,在pox.xml中指定,代目如下: <build> <finalName>your project name</fi
指定mavne中jdk编译版本方法
在pom文件中配置 plugins org.apache.maven.plugins maven-compiler-plugin 2.0.2 1.7 1.7 utf-8
指定jdk
Linux为Tomecat指定JDK   在搭建Jenkin+Sonar集成时,由于系统环境配置了jdk1.7,但是jenkins在安装sonar的插件时,需要jdk1.8.,所以需要在Tomcat指定jdk1.8.   (1)暂停Tomcat [hermes@fastdfs1 bin]./startup.sh  (2)修改catalina.sh和setclasspath.sh  在上面的两...
windows运行jar包指定jdk路径
windows运行jar包指定jdk路径的脚本文件。可以不用系统的jdk运行,指定某个文件下的jdk运行jar包
jdk编译
1.按照Homebrew https://brew.sh/index_zh-cn.html lcc@localhost jdk$ /usr/bin/ruby -e &amp;amp;amp;amp;amp;amp;quot;$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)&amp;amp;amp;amp;amp;amp;quot; ==&amp;amp;amp;amp;amp;amp;amp;g
编译JDK
重新把jvm虚拟机原理剖析这本书拿在书中,瞬间有一种编译JDK源代码的冲动,于是就开始了编译JDK之路。。。
编译jdk
0、cd jdk11u 1、bash configure --with-boot-jdk=../../jdk-11_linux-x64_bin.tar.gz --disable-warnings-as-errors ; 如果需要debug: bash configure --with-boot-jdk=../../jdk-11_linux-x64_bin.tar.gz --disab...
请教windows下编译open jdk问题
大家好:rn 我现在需要在windows7下自己编译open jdk,参考http://www.iteye.com/topic/1097344这个帖子的步骤。其中他提到rn“第三步是安装一个大于2.3版的FreeType ,这是一个免费的字体渲染库,JDK的Swing部分和JConsole这类工具要使用到它。安装好后建立两个环境变量“ALT_FREETYPE_LIB_PATH”和“ALT_FREETYPE_HEADERS_PATH”,分别指向FreeType安装目录下的bin目录和include目录。另外还有一点官方文档没有提到但必须要做的事情是把FreeType的bin目录加入到PATH环境变量中。”rnrn我不太明白怎么安装FreeType,我下载了free Type,看似是在linux环境下编译的,是要在cygwin下安装么,如果是该如何操作,不知道这个帖子中提到的安装free type是如何操作
ant 编译,java jdk版本为jdk1.6.0_03问题
我用ant编译,项目对应的java jdk版本为jdk1.6.0_03rn检查build.xml也没有问题,用ant编译,报错如下。不知是什么原因,烦指点下。多谢!rn [javac] javac: invalid target release: 1.5rn [javac] Usage: javac rn [javac] where possible options include:rn [javac] -g Generate all debugging inforn [javac] -g:none Generate no debugging inforn [javac] -g:lines,vars,source Generate only some debugging inforn [javac] -nowarn Generate no warningsrn [javac] -verbose Output messages about what the compiler is doingrn [javac] -deprecation Output source locations where deprecated APIs are usedrn [javac] -classpath Specify where to find user class filesrn [javac] -sourcepath Specify where to find input source filesrnrn [javac] -bootclasspath Override location of bootstrap class filesrn [javac] -extdirs Override location of installed extensionsrn [javac] -d Specify where to place generated class filesrn [javac] -encoding Specify character encoding used by source filesrn [javac] -source Provide source compatibility with specified releasern [javac] -target Generate class files for specific VM versionrn [javac] -help Print a synopsis of standard optionsrnrn
ant编译jdk源码出错,求高手解答
由于eclipse调试jdk源码时局部变量没有调试信息,于是想用ant编译jdk中src.zip里面的源码,加入调试信息,但是在用ant编译的时候总是报符号找不到的错误,类路径已经设置了,找不到原因,求高手解答,下面是ant的build.xml源码:rn[code=text]rnrnrn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn $classpathrn rn rnrn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rnrn rn rn [/code]
ant编译文件
这个是自己写的一个能用的ant编译脚本,需要的就拿去,
ANT配置,打包,编译
ANT配置,打包,编译
ant编译命令总结
作为apache下的一个编译工具,可以用来编译一些较大的java web项目,简单实用方便!
ant编译android项目
如果是没有android library 项, 执行tools下面的android命令:android update projec android update project -p . -t android-21 如果有android library先到library下面执行android update lib-project -p ./  (注意是 lib-project) 再回到项
ant编译java工程
NULL 博文链接:https://liuna718-163-com.iteye.com/blog/1859773
ant编译怪异问题
BUILD FAILEDE:\work\Favorites4.5\build.xml:37: The following error occurred while executingthis line:E:\work\Favorites4.5\MSFService\ant\msfServiceSdkAnt.xml:17: The following error occurred while exe
ant编译,找不到类
项目开发中在对图片进行裁切处理的时候,有时候是会使用到 com.sun 包下的类时, 如果项目使用ant编译,会出现错误 com.sun.image.codec.jpeg does not exist 这是因为在JDK1.7+时,Oracle不允许使用sun.*的jar   具体参见http://www.oracle.com/technetwork/java/faq-sun-packag...
Ant 编译 运行 java
  HelloWorld.java package com.chan.test;   public class HelloWorld{   public static void main(String args[]){ System.out.println(&quot;Hello Chan include package&quot;); } }   build.xml &amp;lt;?xml ve...
ant 编译文件出错
rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rnrn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn我的配置文件如上。但编译的时候出现引用外部的一些jar包引用不到。rn哪位大侠帮忙修改一下哈。
ant 如何编译jsp?
比如要编译为在weblogic上运行,silver上运行的jsp的class,如何写ant的build.xml啊?rnrnrnrnrn
eclipse中的ant编译
我写了一个插件,用eclipse编译、打包、运行都没问题,但是后来用ant,脱离eclipse运行ant,结果不能运行,后来我就try了一下,我发现是ant的编译的问题,因为如果不作ant的编译,直接用ant打包的话,运行没有问题。rnrn 当然,也不是所有的用ant编译都有问题,只是这个跟ui特别相关的插件有问题rnrn 也不知道eclipse到底咋编译的,不装jdk,eclipse就能编译,所以说eclipse不依赖与jdkrn rnrnrn 请大侠们帮帮忙啊rnrn
ant 编译脚本问题
ant build.xml编译带有标注的java文件时报错。rnjava文件:rnpackage com.greatmay.model;rnrnimport java.text.DecimalFormat;rnimport java.util.ArrayList;rnimport java.util.Collections;rnimport java.util.Date;rnimport java.util.List;rnrnimport javax.persistence.Column;rnimport javax.persistence.Entity;rnimport javax.persistence.EnumType;rnimport javax.persistence.Enumerated;rnimport javax.persistence.GeneratedValue;rnimport javax.persistence.GenerationType;rnimport javax.persistence.Id;rnimport javax.persistence.Table;rnimport javax.persistence.Transient;rnimport javax.xml.bind.annotation.XmlRootElement;rnimport javax.xml.bind.annotation.XmlTransient;rnrnimport org.codehaus.jackson.annotate.JsonIgnoreProperties;rnimport org.hibernate.annotations.NamedQueries;rnimport org.hibernate.annotations.NamedQuery;rnimport org.hibernate.search.annotations.DocumentId;rnimport org.hibernate.search.annotations.Field;rnimport org.hibernate.search.annotations.Indexed;rnrn@NamedQueries(rn @NamedQuery(rn name = "book.orderByDate",rn query = "from Book s order by status asc, presentDate desc "rn ),rn @NamedQuery(rn name = "book.countAll",rn query = "select Count(*) from Book s"rn ),rn @NamedQuery(rn name = "book.findFree",rn query = "from Book s where s.price = 0 order by status asc, presentDate desc "rn ),rn @NamedQuery(rn name = "book.countFree",rn query = "select Count(*) from Book s where s.price = 0 "rn ),rn)rn@JsonIgnoreProperties(value="categories")rn@Entityrn@Table(name = "book")rn@Indexedrn@XmlRootElementrnpublic class Book extends BaseObject rn private static final long serialVersionUID = -7869107480253849972L;rn public static final String QUERY_ORDERBYDATE = "book.orderByDate";rn public static final String COUNT_COUNTALL = "book.countAll";rn public static final String QUERY_FINDFREE = "book.findFree";rn public static final String COUNT_COUNTFREE = "book.countFree";rn public static final String QUERY_ORDERBYCOMMENTS = "book.orderByComments";rn public static final String QUERY_ORDERBYSALES = "book.orderBySales";rn public static final String DESCRIPTION_PIC = "cover.jpg";rn public static final String PREVIEW_PIC = "preview.jpg";rn public static final String DETAILS_PAGE = "details.html";rn @Idrn @GeneratedValue(strategy = GenerationType.AUTO)rn @DocumentIdrn private Long id;rn @Column(nullable = true)rn private String name;;rn @Column(nullable = true)rn private String fileName;rn @Column(nullable = true)rn @Fieldrn private String category; rn @Column(nullable = true)rn private String descFolderPath;rn @Column(nullable = true, length=511)rn @Field rn private String brief;rn @Column(nullable = true, length=1023)rn @Fieldrn private String description;rn @Column(nullable = true)rn @Fieldrn private String otherinfo; rn @Column(nullable = true)rn @Fieldrn private String publisher;rn @Column(nullable = true)rn private Date presentDate;rn @Column(nullable = true)rn @Fieldrn private String author;rn @Column(nullable = true)rn @Fieldrn private String releationbook;rn @Column(nullable = true)rn private Long point;rn @Column(nullable = true)rn private Double price;rn @Column(nullable = true)rn private Double priceInSales;rn @Column(nullable = true)rn @Enumerated(EnumType.ORDINAL)rn private ProductStatus status;rn rnrn @Column(nullable = true)rn @Fieldrn private String publicOrder;rn @Column(nullable = true)rn @Fieldrn private String pages;rn @Column(nullable = true)rn @Fieldrn private String words;rn @Column(nullable = true)rn @Fieldrn private Date printDate;rn @Column(nullable = true)rn @Fieldrn private String kb;rn @Column(nullable = true)rn @Fieldrn private String paper;rn @Column(nullable = true)rn @Fieldrn private String isbn;rn @Column(nullable = true)rn @Fieldrn private String pakage;rn @Column(nullable = true)rn @Fieldrn private int pjCnt;rn @Column(nullable = true)rn @Fieldrn private int buyCnt;rnrn /**rn * Default constructor - creates a new instance with no values set.rn */rn public Book() rn rnrnrn public Long getId() rn return id;rn rnrnrn @Transient @XmlTransientrn public List getCategories() rn if (category == null || category.isEmpty()) rn return new ArrayList(0);rn rn String[] categorisArray = category.split(",");rn List categories = new ArrayList(categorisArray.length);rn Collections.addAll(categories, categorisArray);rn Collections.sort(categories);rn return categories;rn rnrn public void setCategories(List categories) rn if (categories != null) rn StringBuilder sb = new StringBuilder();rn for (String s : categories) rn sb.append(Category.SPERATER).append(s);rn rn if (sb.length() >= 1) rn sb.deleteCharAt(0);rn rn this.category = sb.toString();rn rn rnrn public void setCategories(String[] categories) rn if (categories != null) rn StringBuilder sb = new StringBuilder();rn for (String s : categories) rn sb.append(Category.SPERATER).append(s);rn rn if (sb.length() >= 1) rn sb.deleteCharAt(0);rn rn this.category = sb.toString();rn rn rnrnrn public String getCategory() rn return category;rn rnrnrn public String getBrief() rn return brief;rn rnrnrn public String getDescription() rn return description;rn rnrnrn public String getOtherinfo() rn return otherinfo;rn rnrnrn public String getName() rn return name;rn rnrnrn public String getPublisher() rn return publisher;rn rnrnrn public Date getPresentDate() rn return presentDate;rn rnrnrn public String getAuthor() rn return author;rn rnrnrn public Double getPrice() rn return price;rn rnrnrn public Double getPriceInSales() rn return priceInSales;rn rnrnrn public ProductStatus getStatus() rn return status;rn rnrnrn public void setId(Long id) rn this.id = id;rn rnrnrn public void setCategory(String category) rn this.category = category;rn rnrnrn public void setBrief(String brief) rn this.brief = brief;rn rnrnrn public void setDescription(String description) rn this.description = description;rn rnrnrn public void setOtherinfo(String otherinfo) rn this.otherinfo = otherinfo;rn rnrnrn public void setName(String name) rn this.name = name;rn rnrnrn public void setPublisher(String publisher) rn this.publisher = publisher;rn rnrnrn public void setPresentDate(Date presentDate) rn this.presentDate = presentDate;rn rnrnrn public void setAuthor(String author) rn this.author = author;rn rnrnrn public void setPrice(Double price) rn this.price = price;rn rnrnrn public void setPriceInSales(Double priceInSales) rn this.priceInSales = priceInSales;rn rnrnrn public void setStatus(ProductStatus status) rn this.status = status;rn rnrnrn public String getFileName() rn return fileName;rn rnrnrn public String getDescFolderPath() rn return descFolderPath;rn rnrnrn public void setFileName(String fileName) rn this.fileName = fileName;rn rnrnrn public void setDescFolderPath(String descFolderPath) rn this.descFolderPath = descFolderPath;rn rnrnrn public Long getPoint() rn return point;rn rnrnrn public void setPoint(Long point) rn this.point = point;rn rnrn @Transientrn public String getDisplayBrief(int length) rn if (brief != null && brief.length() > length) rn return brief.substring(0, length - 1) + "……";rn rn return brief;rn rn @Transientrn public String getDisplayDescription(int length) rn if (description != null && description.length() > length) rn return description.substring(0, length - 1) + "……";rn rn return description;rn rn @Transientrn public Double getRealPrice() rn if (price == 0) rn return price;rn else if (priceInSales <= 0)rn return price;rn else rn return price <= priceInSales ? price : priceInSales;rn rn rn @Transientrn public String getZk() rn if (price == 0) rn return "无";rn rn Double z = getRealPrice()/price*10;rn DecimalFormat df = new DecimalFormat("0.0");rn String filesize = df.format(z);//返回的是String类型的rn if("10".equals(filesize))rn return "无";rn elsern return filesize;rn rn rnrn public String getReleationbook() rn return releationbook;rn rnrnrn public void setReleationbook(String releationbook) rn this.releationbook = releationbook;rn rnrnrn public String getPublicOrder() rn return publicOrder;rn rnrnrn public void setPublicOrder(String publicOrder) rn this.publicOrder = publicOrder;rn rnrnrn public String getPages() rn return pages;rn rnrnrn public void setPages(String pages) rn this.pages = pages;rn rnrnrn public String getWords() rn return words;rn rnrnrn public void setWords(String words) rn this.words = words;rn rnrnrn public Date getPrintDate() rn return printDate;rn rnrnrn public void setPrintDate(Date printDate) rn this.printDate = printDate;rn rnrnrn public String getKb() rn return kb;rn rnrnrn public void setKb(String kb) rn this.kb = kb;rn rnrnrn public String getPaper() rn return paper;rn rnrnrn public void setPaper(String paper) rn this.paper = paper;rn rnrn public String getIsbn() rn return isbn;rn rnrnrn public void setIsbn(String isbn) rn this.isbn = isbn;rn rnrnrn public String getPakage() rn return pakage;rn rnrnrn public void setPakage(String pakage) rn this.pakage = pakage;rn rnrnrn public int getPjCnt() rn return pjCnt;rn rnrnrn public void setPjCnt(int pjCnt) rn this.pjCnt = pjCnt;rn rnrnrn public int getBuyCnt() rn return buyCnt;rn rnrnrn public void setBuyCnt(int buyCnt) rn this.buyCnt = buyCnt;rn rnrn报错信息如下:rn [javac] D:\worksapce4-android\DMServ\src\com\greatmay\model\Book.java:54: 非法的表达式开始rn [javac] )rn [javac] ^
ant编译flex脚本
利用ant编译flex脚本,可以直接在你的程序中使用。
ant编译依赖包
ant 编译jar包
相关热词 c# 标准差 计算 c#siki第五季 c#入门推荐书 c# 解码海康数据流 c# xml的遍历循环 c# 取 查看源码没有的 c#解决高并发 委托 c#日期转化为字符串 c# 显示问号 c# 字典对象池