修改config的bug

下一步将要把Judger模块的语言编译器路径、运行命令改由xml读取
This commit is contained in:
Jered Ye 2024-01-12 23:51:48 +08:00
parent ee8a218653
commit 45c1b70d52
79 changed files with 453 additions and 502 deletions

Binary file not shown.

BIN
Common/dist/Common.jar vendored

Binary file not shown.

View File

@ -25,7 +25,7 @@ public class Config {
static { static {
try { try {
InputStream in = new FileInputStream(FileFinder.findFile("config.properties")); InputStream in = new FileInputStream(FileFinder.findFile("config/config.properties"));
prop.load(in); prop.load(in);
DEBUG = Integer.valueOf(prop.getProperty("Debug")); DEBUG = Integer.valueOf(prop.getProperty("Debug"));
// isCppRelative = prop.getProperty("isCppRelative").equals("true") ? true : false; // isCppRelative = prop.getProperty("isCppRelative").equals("true") ? true : false;
@ -42,6 +42,7 @@ public class Config {
} else { } else {
JavaRelative = -1; JavaRelative = -1;
} }
} catch (Exception e) { } catch (Exception e) {
Log.writeExceptionLog(e.getClass()+e.getMessage()); Log.writeExceptionLog(e.getClass()+e.getMessage());
e.printStackTrace(); e.printStackTrace();
@ -50,11 +51,11 @@ public class Config {
public static void freshConfig() { public static void freshConfig() {
try { try {
InputStream in = new FileInputStream(FileFinder.findFile("config.properties")); InputStream in = new FileInputStream(FileFinder.findFile("config/config.properties"));
prop.load(in); prop.load(in);
DEBUG = Integer.valueOf(prop.getProperty("Debug")); DEBUG = Integer.valueOf(prop.getProperty("Debug"));
// isCppRelative = prop.getProperty("isCppRelative").equals("true") ? true : false;
// isJavaRelative = prop.getProperty("isJavaRelative").equals("true")?true: false;
String tmp = prop.getProperty(Const.MinGWRelative); String tmp = prop.getProperty(Const.MinGWRelative);
if (tmp != null && !"".equals(tmp)) { if (tmp != null && !"".equals(tmp)) {
@ -86,7 +87,7 @@ public class Config {
public static void save() { public static void save() {
try { try {
// 文件输出流 // 文件输出流
FileOutputStream fos = new FileOutputStream(FileFinder.findFile("config.properties")); FileOutputStream fos = new FileOutputStream(FileFinder.findFile("config/config.properties"));
// 将Properties集合保存到流中 // 将Properties集合保存到流中
prop.store(fos, "update config.properties"); prop.store(fos, "update config.properties");
fos.close();// 关闭流 fos.close();// 关闭流
@ -127,9 +128,9 @@ public class Config {
if (language.equals("c") || language.equals("cpp") || language.equals("c++")) //返回各种语言的编译器地址 if (language.equals("c") || language.equals("cpp") || language.equals("c++")) //返回各种语言的编译器地址
{ {
dir = System.getProperty("user.dir") + Const.RelativeMinGWCompileDir; dir = System.getProperty("user.dir") + Const.MinGWDir;
} else if (language.equals("java")) { } else if (language.equals("java")) {
dir = System.getProperty("user.dir") + Const.RelativeJavaCompileDir; dir = System.getProperty("user.dir") + Const.JavaCompilerDir;
} }
return dir; return dir;
} }

View File

@ -41,9 +41,9 @@ public class Const {
return null; return null;
} }
public static final String cCompilerDirIdentify = "cCompilerDir"; public static final String cCompilerDirIdentify = "MinGWDir";//"cCompilerDir";
public static final String cppCompilerDirIdentify = "cppCompilerDir"; public static final String cppCompilerDirIdentify = "MinGWDir";//"cppCompilerDir"
public static final String javaCompilerDirIdentify = "javaCompilerDir"; public static final String javaCompilerDirIdentify = "JavaCompileDir";
public static final String JavaCompilerDir = "JavaCompileDir"; public static final String JavaCompilerDir = "JavaCompileDir";
public static final String RelativeJavaCompileDir = "\\Java\\bin"; public static final String RelativeJavaCompileDir = "\\Java\\bin";
public static final String JavaRelative = "JavaRelative"; public static final String JavaRelative = "JavaRelative";

View File

@ -14,9 +14,38 @@ import java.util.List;
* @author Administrator * @author Administrator
*/ */
public class FileFinder { public class FileFinder {
private static String findFilePath(String fileName) {
String currentPath = System.getProperty("user.dir");
String configFile = fileName;
// Try to find config.xml in the current directory
File currentDirConfigFile = new File(currentPath, configFile);
System.out.print(currentDirConfigFile.getAbsoluteFile());
if (currentDirConfigFile.exists()) {
return currentDirConfigFile.getAbsolutePath();
}
// If not found, recursively search in parent directories
return findInParentDirectory(new File(currentPath), configFile);
}
private static String findInParentDirectory(File directory, String configFile) {
File configFileInParent = new File(directory, configFile);
if (configFileInParent.exists()) {
return configFileInParent.getAbsolutePath();
}
// If not found and not the root directory, recursively search in parent
File parentDirectory = directory.getParentFile();
if (parentDirectory != null) {
return findInParentDirectory(parentDirectory, configFile);
}
// If reached the root directory and still not found, return null
return null;
}
public static File findFile(String fileName){ public static File findFile(String fileName){
return new File("config/"+fileName); return new File(findFilePath(fileName));
} }
public static boolean isExistFile(String fileName){ public static boolean isExistFile(String fileName){

View File

@ -0,0 +1,157 @@
package common;
import java.io.File;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import java.util.HashMap;
import javax.swing.JOptionPane;
import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathExpressionException;
import javax.xml.xpath.XPathFactory;
import org.w3c.dom.Document;
/**
*
* @author Jared Ye
*/
public abstract class LangSelector {
private static String ConfigPath="";
private static Document Data;
public static boolean Loaded=false;
private static XPath xpath = XPathFactory.newInstance().newXPath();
static {
try {
ConfigPath=findConfigFilePath();
Data = init(ConfigPath);
Loaded=true;
} catch (Exception e) {
//初始化的时候没有读到config.xml
}
}
private static String findConfigFilePath() {
String currentPath = System.getProperty("user.dir");
String configFile = "config.xml";
// Try to find config.xml in the current directory
File currentDirConfigFile = new File(currentPath, configFile);
if (currentDirConfigFile.exists()) {
return currentDirConfigFile.getAbsolutePath();
}
// If not found, recursively search in parent directories
return findConfigInParentDirectory(new File(currentPath), configFile);
}
private static String findConfigInParentDirectory(File directory, String configFile) {
File configFileInParent = new File(directory, configFile);
if (configFileInParent.exists()) {
return configFileInParent.getAbsolutePath();
}
// If not found and not the root directory, recursively search in parent
File parentDirectory = directory.getParentFile();
if (parentDirectory != null) {
return findConfigInParentDirectory(parentDirectory, configFile);
}
// If reached the root directory and still not found, return null
return null;
}
//自动递归向上级获取config.xml的路径
public static String getConfigPath(){
return ConfigPath;
}
public static String getDefaultCompilerName(String languageName){
//if(languageName.charAt(0)>='a')languageName
try{
String exp="/languages/language"+ "[@id='" +languageName+ "']"+"/compiler[1]/@name";
return (String) xpath.evaluate(exp,Data);
} catch (XPathExpressionException e) {
System.out.println(e.getMessage());
return null;
}
}
//当没有指定具体的编译器时自动获取一个默认的编译器
public static Document init(String ConfigPath) throws Exception {
// 创建Document对象
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
dbf.setValidating(false);
DocumentBuilder db = dbf.newDocumentBuilder();
// 创建XPath对象
LangSelector.ConfigPath =ConfigPath;
//JOptionPane.showMessageDialog(null,"当前工作目录:"+ConfigPath);
// LangSelector.ConfigPath=new File(LangSelector.ConfigPath).getAbsolutePath();
return db.parse(LangSelector.ConfigPath);
}
public static String getCompilerPath(String languageName,String compilerName) {
if(compilerName==null)compilerName=getDefaultCompilerName(languageName);
try{
String exp="/languages/language"+ "[@id='" +languageName+ "']"+"//compiler[@name='"+compilerName+"']//path/text()";
return (String) xpath.evaluate(exp,Data);
} catch (XPathExpressionException e) {
System.out.println(e.getMessage());
return null;
}
}
public static String getCompileCommand(String languageName,String compilerName){
if(compilerName==null)compilerName=getDefaultCompilerName(languageName);
try{
String exp="/languages/language"+ "[@id='" +languageName+ "']"+"//compiler[@name='"+compilerName+"']//compileCmd/text()";
return (String) xpath.evaluate(exp,Data);
} catch (XPathExpressionException e) {
System.out.println(e.getMessage());
return null;
}
}
public static String getLinkCommand(String languageName,String compilerName){
if(compilerName==null)compilerName=getDefaultCompilerName(languageName);
try{
String exp="/languages/language"+ "[@id='" +languageName+ "']"+"//compiler[@name='"+compilerName+"']//linkCmd/text()";
return (String) xpath.evaluate(exp,Data);
} catch (XPathExpressionException e) {
System.out.println(e.getMessage());
return null;
}
}
public static String getRunCommand(String languageName,String compilerName){
if(compilerName==null)compilerName=getDefaultCompilerName(languageName);
try{
String exp="/languages/language"+ "[@id='" +languageName+ "']"+"//compiler[@name='"+compilerName+"']//runCmd/text()";
return (String) xpath.evaluate(exp,Data);
} catch (XPathExpressionException e) {
System.out.println(e.getMessage());
return null;
}
}
public enum PlaceHolder{
SourceFile("$sourceFile$"),
ObjFile("$objFile$"),
ExeFile("$exeFile$"),
CompilerPath("$compilerPath$");
private final String strPlaceHolder;
private PlaceHolder(String str){
strPlaceHolder=str;
}
public String getStr(){
return strPlaceHolder;
}
}
public static String matchPlaceHolder(String src, HashMap<String,String>map){
for (java.util.Map.Entry<String, String> Entry : map.entrySet()) {
src = src.replace(Entry.getKey(), Entry.getValue());
System.out.println(Entry.getKey() + "已替换:" + Entry.getValue());
}
return src;
}
}

View File

@ -0,0 +1,29 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package common;
import static common.LangSelector.*;
import java.util.HashMap;
/**
*
* @author tange
*/
public class LangSelectorTest {
public static void main(String[] args) {
String compileCmd=getCompileCommand("C++","MinGW");
HashMap<String,String> map=new HashMap<String,String>(){
{
put(LangSelector.PlaceHolder.SourceFile.getStr(), "TestSourceFile");
put(LangSelector.PlaceHolder.ObjFile.getStr(), "TestObjFile");
}
};
compileCmd=matchPlaceHolder(compileCmd,map);
System.out.println(compileCmd);
System.out.println(getDefaultCompilerName("C++"));
}
}

View File

@ -0,0 +1,63 @@
<?xml version="1.0" encoding="utf-8"?>
<languages>
<language id="C++">
<compiler name="MinGW">
<path>C:/MinGW/bin/</path>
<compileCmd>g++.exe -Wall -g -std=c++14 -c $sourceFile$ -o $objFile$</compileCmd>
<!-- g++.exe -Wall -g -std=c++14 -c D:\prog_old\test\main.cpp -o obj\Debug\main.o-->
<linkCmd>g++.exe -o $exeFile$ $objFile$ -O1</linkCmd>
<!-- g++.exe -o bin\Debug\test.exe obj\Debug\main.o -O1-->
<runCmd>$exeFile$</runCmd>
</compiler>
<compiler name="MSVC">
<path>C:/MinGW/bin/</path>
<compileCmd>g++.exe -Wall -g -std=c++14 -c $sourceFile$ -o $objFile$</compileCmd>
<!-- g++.exe -Wall -g -std=c++14 -c D:\prog_old\test\main.cpp -o obj\Debug\main.o-->
<linkCmd>g++.exe -o $exeFile$ $objFile$ -O1</linkCmd>
<!-- g++.exe -o bin\Debug\test.exe obj\Debug\main.o -O1-->
<runCmd>helloworld</runCmd>
</compiler>
</language>
<language id="Java">
<compiler name="JDK8">
<path>C:/MinGW/bin/</path>
<compileCmd>g++.exe -Wall -g -std=c++14 -c $sourceFile$ -o $objFile$</compileCmd>
<!-- g++.exe -Wall -g -std=c++14 -c D:\prog_old\test\main.cpp -o obj\Debug\main.o-->
<linkCmd>g++.exe -o $exeFile$ $objFile$ -O1</linkCmd>
<!-- g++.exe -o bin\Debug\test.exe obj\Debug\main.o -O1-->
<runCmd>$exeFile$</runCmd>
</compiler>
<compiler name="JDK9">
<path>C:/MinGW/bin/</path>
<compileCmd>g++.exe -Wall -g -std=c++14 -c $sourceFile$ -o $objFile$</compileCmd>
<!-- g++.exe -Wall -g -std=c++14 -c D:\prog_old\test\main.cpp -o obj\Debug\main.o-->
<linkCmd>g++.exe -o $exeFile$ $objFile$ -O1</linkCmd>
<!-- g++.exe -o bin\Debug\test.exe obj\Debug\main.o -O1-->
<runCmd>
</runCmd>
</compiler>
</language>
<language id="Python">
<compiler name="Python2">
<path>C:/MinGW/bin/</path>
<compileCmd>g++.exe -Wall -g -std=c++14 -c $sourceFile$ -o $objFile$</compileCmd>
<!-- g++.exe -Wall -g -std=c++14 -c D:\prog_old\test\main.cpp -o obj\Debug\main.o-->
<linkCmd>g++.exe -o $exeFile$ $objFile$ -O1</linkCmd>
<!-- g++.exe -o bin\Debug\test.exe obj\Debug\main.o -O1-->
<runCmd>$exeFile$</runCmd>
</compiler>
<compiler name="Python3">
<path>C:/MinGW/bin/</path>
<compileCmd>g++.exe -Wall -g -std=c++14 -c $sourceFile$ -o $objFile$</compileCmd>
<!-- g++.exe -Wall -g -std=c++14 -c D:\prog_old\test\main.cpp -o obj\Debug\main.o-->
<linkCmd>g++.exe -o $exeFile$ $objFile$ -O1</linkCmd>
<!-- g++.exe -o bin\Debug\test.exe obj\Debug\main.o -O1-->
<runCmd>
</runCmd>
</compiler>
</language>
<!-- sourceFile-->
<!-- objFile-->
<!-- exeFile-->
<language id="VB" />
</languages>

23
ConfigEditor.deps.json Normal file
View File

@ -0,0 +1,23 @@
{
"runtimeTarget": {
"name": ".NETCoreApp,Version=v6.0",
"signature": ""
},
"compilationOptions": {},
"targets": {
".NETCoreApp,Version=v6.0": {
"ConfigEditor/1.0.0": {
"runtime": {
"ConfigEditor.dll": {}
}
}
}
},
"libraries": {
"ConfigEditor/1.0.0": {
"type": "project",
"serviceable": false,
"sha512": ""
}
}
}

BIN
ConfigEditor.dll Normal file

Binary file not shown.

BIN
ConfigEditor.exe Normal file

Binary file not shown.

View File

@ -0,0 +1,18 @@
{
"runtimeOptions": {
"tfm": "net6.0",
"frameworks": [
{
"name": "Microsoft.NETCore.App",
"version": "6.0.0"
},
{
"name": "Microsoft.WindowsDesktop.App",
"version": "6.0.0"
}
],
"configProperties": {
"System.Reflection.Metadata.MetadataUpdater.IsSupported": false
}
}
}

View File

@ -1,4 +1,4 @@
#Fri, 12 Jan 2024 21:11:15 +0800 #Fri, 12 Jan 2024 23:38:16 +0800
K\:\\OJ\\JuderUI= K\:\\OJ\\JuderUI=

Binary file not shown.

View File

@ -1,5 +1,5 @@
#update config.properties #update config.properties
#Fri Jan 12 21:11:20 CST 2024 #Fri Jan 12 23:38:08 CST 2024
srcDir=G\:\\org\\JuderUI\\test srcDir=G\:\\org\\JuderUI\\test
isCppRelative=true isCppRelative=true
relativeJavaCompilerDir=C\:\\Program Files\\Java\\jdk1.8.0_40\\bin relativeJavaCompilerDir=C\:\\Program Files\\Java\\jdk1.8.0_40\\bin
@ -8,19 +8,19 @@ cCompilerDir=C\:\\\u65B0\u5EFA\u6587\u4EF6\u5939
ThreadNumber=1 ThreadNumber=1
distributorPort=80 distributorPort=80
exeDir=G\:\\org\\JuderUI\\TMP exeDir=G\:\\org\\JuderUI\\TMP
MinGWDir=Z\:\\project\\OJ\\client\\MinGW\\bin MinGWDir=C\:\\MinGW\\bin
relativeCCompilerDir=\\MinGW\\bin relativeCCompilerDir=\\MinGW\\bin
distributorIP=106.15.36.190 distributorIP=106.15.36.190
JavaRelative=2 JavaRelative=3
>>>>>>>=.r76 >>>>>>>=.r76
isJavaRelative=true isJavaRelative=true
<<<<<<<=.mine <<<<<<<=.mine
MinGWRelative=3 MinGWRelative=3
relativeCppCompilerDir=\\MinGW\\bin relativeCppCompilerDir=\\MinGW\\bin
javaCompilerDir=\\\\vmware-host\\Shared Folders\\\u6587\u7A3F\\NetBeansProjects\\oj\\client\\MinGW\\bin javaCompilerDir=\\\\vmware-host\\Shared Folders\\\u6587\u7A3F\\NetBeansProjects\\oj\\client\\MinGW\\bin
JavaCompileDir=C\:\\Program Files\\Java\\jdk1.8.0_202\\bin JavaCompileDir=C\:\\Program Files\\Java\\jdk1.8.0_121\\bin
Debug=1 Debug=1
URLaddress=10.202.40.190 URLaddress=10.202.40.190
StartThreadAuto=true StartThreadAuto=true
cppCompilerDir=\\\\vmware-host\\Shared Folders\\\u6587\u7A3F\\NetBeansProjects\\oj\\client\\MinGW\\bin
=\=\=\=\=\=\= =\=\=\=\=\=\=
cppCompilerDir=\\\\vmware-host\\Shared Folders\\\u6587\u7A3F\\NetBeansProjects\\oj\\client\\MinGW\\bin

BIN
JuderUI/dist.zip Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,3 @@
22:27:04 class java.lang.NullPointerExceptionnull
22:28:50 class java.lang.NullPointerExceptionnull
22:31:39 class java.lang.NullPointerExceptionnull

View File

@ -80,7 +80,9 @@
<Component id="buttonCompilersConfig" min="-2" max="-2" attributes="0"/> <Component id="buttonCompilersConfig" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
<Component id="buttonCompilersConfig1" min="-2" max="-2" attributes="0"/> <Component id="buttonCompilersConfig1" min="-2" max="-2" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
<Component id="jButton2" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="18" max="-2" attributes="0"/>
<Component id="jLabel3" min="-2" max="-2" attributes="0"/> <Component id="jLabel3" min="-2" max="-2" attributes="0"/>
<EmptySpace min="0" pref="0" max="32767" attributes="0"/> <EmptySpace min="0" pref="0" max="32767" attributes="0"/>
<Component id="distributorIP" min="-2" pref="211" max="-2" attributes="0"/> <Component id="distributorIP" min="-2" pref="211" max="-2" attributes="0"/>
@ -133,6 +135,7 @@
<Component id="distributorIP" alignment="3" min="-2" max="-2" attributes="0"/> <Component id="distributorIP" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jLabel3" alignment="3" min="-2" max="-2" attributes="0"/> <Component id="jLabel3" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="buttonCompilersConfig1" alignment="3" min="-2" max="-2" attributes="0"/> <Component id="buttonCompilersConfig1" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jButton2" alignment="3" min="-2" max="-2" attributes="0"/>
</Group> </Group>
<Group type="103" alignment="1" groupAlignment="3" attributes="0"> <Group type="103" alignment="1" groupAlignment="3" attributes="0">
<Component id="jLabel4" alignment="3" min="-2" max="-2" attributes="0"/> <Component id="jLabel4" alignment="3" min="-2" max="-2" attributes="0"/>
@ -515,6 +518,14 @@
<AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="0"/> <AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="0"/>
</AuxValues> </AuxValues>
</Component> </Component>
<Component class="javax.swing.JButton" name="jButton2">
<Properties>
<Property name="text" type="java.lang.String" value="&#x67e5;&#x770b;&#x914d;&#x7f6e;&#x6587;&#x4ef6;"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton2ActionPerformed"/>
</Events>
</Component>
</SubComponents> </SubComponents>
</Container> </Container>
</SubComponents> </SubComponents>

View File

@ -8,10 +8,13 @@ package gui;
import cache.ProblemsCachManager; import cache.ProblemsCachManager;
import common.Config; import common.Config;
import common.FileFinder; import common.FileFinder;
import common.LangSelector;
import java.awt.Component; import java.awt.Component;
import java.awt.Desktop;
import java.awt.event.WindowAdapter; import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent; import java.awt.event.WindowEvent;
import java.io.File; import java.io.File;
import java.io.IOException;
import javax.swing.JOptionPane; import javax.swing.JOptionPane;
import javax.xml.namespace.QName; import javax.xml.namespace.QName;
import share.gui.NewCompileSetting; import share.gui.NewCompileSetting;
@ -88,7 +91,7 @@ public class MainFrame extends javax.swing.JFrame {
jLabel5 = new javax.swing.JLabel(); jLabel5 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel(); jLabel2 = new javax.swing.JLabel();
jLabel7 = new javax.swing.JLabel(); jLabel7 = new javax.swing.JLabel();
jComboBox1 = new javax.swing.JComboBox<>(); jComboBox1 = new javax.swing.JComboBox<String>();
threadManagerTabb = new javax.swing.JTabbedPane(); threadManagerTabb = new javax.swing.JTabbedPane();
jPanel7 = new javax.swing.JPanel(); jPanel7 = new javax.swing.JPanel();
jLabel15 = new javax.swing.JLabel(); jLabel15 = new javax.swing.JLabel();
@ -109,6 +112,7 @@ public class MainFrame extends javax.swing.JFrame {
jLabel17 = new javax.swing.JLabel(); jLabel17 = new javax.swing.JLabel();
jButton1 = new javax.swing.JButton(); jButton1 = new javax.swing.JButton();
buttonCompilersConfig1 = new javax.swing.JButton(); buttonCompilersConfig1 = new javax.swing.JButton();
jButton2 = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
@ -145,7 +149,7 @@ public class MainFrame extends javax.swing.JFrame {
jLabel7.setText("线程数量:"); jLabel7.setText("线程数量:");
jComboBox1.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "1", "2", "3", "4" })); jComboBox1.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "1", "2", "3", "4" }));
jLabel15.setText("一般信息:"); jLabel15.setText("一般信息:");
@ -267,6 +271,13 @@ public class MainFrame extends javax.swing.JFrame {
} }
}); });
jButton2.setText("查看配置文件");
jButton2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton2ActionPerformed(evt);
}
});
javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2); javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
jPanel2.setLayout(jPanel2Layout); jPanel2.setLayout(jPanel2Layout);
jPanel2Layout.setHorizontalGroup( jPanel2Layout.setHorizontalGroup(
@ -279,6 +290,8 @@ public class MainFrame extends javax.swing.JFrame {
.addComponent(buttonCompilersConfig) .addComponent(buttonCompilersConfig)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(buttonCompilersConfig1) .addComponent(buttonCompilersConfig1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButton2)
.addGap(18, 18, 18) .addGap(18, 18, 18)
.addComponent(jLabel3) .addComponent(jLabel3)
.addGap(0, 0, Short.MAX_VALUE) .addGap(0, 0, Short.MAX_VALUE)
@ -325,7 +338,8 @@ public class MainFrame extends javax.swing.JFrame {
.addComponent(buttonCompilersConfig) .addComponent(buttonCompilersConfig)
.addComponent(distributorIP, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(distributorIP, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel3) .addComponent(jLabel3)
.addComponent(buttonCompilersConfig1)) .addComponent(buttonCompilersConfig1)
.addComponent(jButton2))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel4) .addComponent(jLabel4)
.addComponent(distributorPort, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))) .addComponent(distributorPort, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
@ -440,7 +454,7 @@ public class MainFrame extends javax.swing.JFrame {
if (tmp == null || "".equals(tmp) || !FileFinder.isExistFile(tmp + File.separator + "gcc.exe") || !FileFinder.isExistFile(tmp + File.separator + "g++.exe")) { if (tmp == null || "".equals(tmp) || !FileFinder.isExistFile(tmp + File.separator + "gcc.exe") || !FileFinder.isExistFile(tmp + File.separator + "g++.exe")) {
//弹窗设置保存 //弹窗设置保存
JOptionPane.showMessageDialog(this, "C语言先配置编译器"); JOptionPane.showMessageDialog(this, "先配置C语言编译器");
NewCompileSetting window = new NewCompileSetting("c", this, true); NewCompileSetting window = new NewCompileSetting("c", this, true);
window.setVisible(true); window.setVisible(true);
return false; return false;
@ -449,7 +463,7 @@ public class MainFrame extends javax.swing.JFrame {
tmp = Config.getCompilerDir("java"); tmp = Config.getCompilerDir("java");
if (tmp == null || "".equals(tmp) || !FileFinder.isExistFile(tmp + File.separator + "javac.exe")) { if (tmp == null || "".equals(tmp) || !FileFinder.isExistFile(tmp + File.separator + "javac.exe")) {
JOptionPane.showMessageDialog(this, "请先Java配置编译器"); JOptionPane.showMessageDialog(this, "请先配置Java编译器");
NewCompileSetting window = new NewCompileSetting("java", this, true); NewCompileSetting window = new NewCompileSetting("java", this, true);
window.setVisible(true); window.setVisible(true);
return false; return false;
@ -477,6 +491,17 @@ public class MainFrame extends javax.swing.JFrame {
javaConfig.setVisible(true); javaConfig.setVisible(true);
}//GEN-LAST:event_buttonCompilersConfig1ActionPerformed }//GEN-LAST:event_buttonCompilersConfig1ActionPerformed
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
Desktop desktop = Desktop.getDesktop();
try {
// 打开文件
desktop.open(new File(LangSelector.getConfigPath()));
} catch (IOException e) {
e.printStackTrace();
}
}//GEN-LAST:event_jButton2ActionPerformed
private void loadConfig() { private void loadConfig() {
this.distributorIP.setText(Config.getValue("distributorIP")); this.distributorIP.setText(Config.getValue("distributorIP"));
this.distributorPort.setText(Config.getValue("distributorPort")); this.distributorPort.setText(Config.getValue("distributorPort"));
@ -560,6 +585,7 @@ public class MainFrame extends javax.swing.JFrame {
private javax.swing.JTextField distributorIP; private javax.swing.JTextField distributorIP;
private javax.swing.JTextField distributorPort; private javax.swing.JTextField distributorPort;
private javax.swing.JButton jButton1; private javax.swing.JButton jButton1;
private javax.swing.JButton jButton2;
private javax.swing.JCheckBox jCheckBox1; private javax.swing.JCheckBox jCheckBox1;
javax.swing.JComboBox<String> jComboBox1; javax.swing.JComboBox<String> jComboBox1;
javax.swing.JLabel jLabel14; javax.swing.JLabel jLabel14;

View File

@ -1,471 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.5" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JDialogFormInfo">
<NonVisualComponents>
<Component class="javax.swing.ButtonGroup" name="buttonGroup1">
</Component>
<Component class="javax.swing.ButtonGroup" name="buttonGroup2">
</Component>
</NonVisualComponents>
<Properties>
<Property name="defaultCloseOperation" type="int" value="2"/>
</Properties>
<SyntheticProperties>
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
<SyntheticProperty name="generateCenter" type="boolean" value="false"/>
</SyntheticProperties>
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
</AuxValues>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="cJPanel" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="javaJPanel" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="31" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="32767" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="cJPanel" alignment="1" min="-2" max="-2" attributes="0"/>
<Component id="javaJPanel" alignment="1" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="-2" pref="23" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Container class="javax.swing.JPanel" name="cJPanel">
<AuxValues>
<AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="1"/>
</AuxValues>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Component id="jLabel2" max="32767" attributes="0"/>
<EmptySpace min="-2" pref="227" max="-2" attributes="0"/>
</Group>
<Group type="102" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<Component id="cRegistry" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="cRegistryList" min="-2" max="-2" attributes="0"/>
</Group>
<Component id="cSystem" min="-2" max="-2" attributes="0"/>
<Component id="cSelf" min="-2" max="-2" attributes="0"/>
<Group type="102" attributes="0">
<EmptySpace min="24" pref="24" max="-2" attributes="0"/>
<Component id="lblCRegistryMessage" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
</Group>
</Group>
</Group>
<Group type="102" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace min="-2" pref="38" max="-2" attributes="0"/>
<Component id="jLabel3" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="38" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="1" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
</Group>
</Group>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Component id="cDir" min="-2" pref="218" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jButton1" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<Component id="cppDir" min="-2" pref="220" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="jButton2" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
</Group>
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="156" max="-2" attributes="0"/>
<Component id="jButton5" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace min="0" pref="6" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="jLabel2" min="-2" pref="23" max="-2" attributes="0"/>
<EmptySpace min="8" pref="8" max="-2" attributes="0"/>
<Component id="cSystem" min="-2" max="-2" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="cRegistry" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="cRegistryList" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="lblCRegistryMessage" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="32" max="32767" attributes="0"/>
<Component id="cSelf" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="7" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="cDir" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jButton1" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jLabel1" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="cppDir" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jLabel3" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jButton2" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Component id="jButton5" min="-2" pref="34" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JButton" name="jButton2">
<Properties>
<Property name="text" type="java.lang.String" value="..."/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton2ActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JLabel" name="jLabel2">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="&#x5b8b;&#x4f53;" size="16" style="1"/>
</Property>
<Property name="text" type="java.lang.String" value="C/C++&#x7f16;&#x8bd1;&#x5668;&#x8bbe;&#x7f6e;"/>
</Properties>
</Component>
<Component class="javax.swing.JRadioButton" name="cSystem">
<Properties>
<Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor">
<ComponentRef name="buttonGroup1"/>
</Property>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="&#x5b8b;&#x4f53;" size="14" style="0"/>
</Property>
<Property name="text" type="java.lang.String" value="&#x4f7f;&#x7528;&#x7cfb;&#x7edf;&#x5185;&#x7f6e;&#x7f16;&#x8bd1;&#x5668;"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="cSystemActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JRadioButton" name="cSelf">
<Properties>
<Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor">
<ComponentRef name="buttonGroup1"/>
</Property>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="&#x5b8b;&#x4f53;" size="14" style="0"/>
</Property>
<Property name="text" type="java.lang.String" value="&#x6307;&#x5b9a;&#x7f16;&#x8bd1;&#x5668;(gcc.exe/g++.exe)&#x6240;&#x5728;&#x6587;&#x4ef6;&#x5939;"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="cSelfActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JRadioButton" name="cRegistry">
<Properties>
<Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor">
<ComponentRef name="buttonGroup1"/>
</Property>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="&#x5b8b;&#x4f53;" size="14" style="0"/>
</Property>
<Property name="text" type="java.lang.String" value="&#x4f7f;&#x7528;&#x672c;&#x673a;&#x6ce8;&#x518c;&#x7684;&#x7f16;&#x8bd1;&#x5668;"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="cRegistryActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JLabel" name="jLabel1">
<Properties>
<Property name="text" type="java.lang.String" value="gcc/g++"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel3">
<Properties>
<Property name="text" type="java.lang.String" value="C++"/>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="cDir">
</Component>
<Component class="javax.swing.JTextField" name="cppDir">
</Component>
<Component class="javax.swing.JButton" name="jButton1">
<Properties>
<Property name="text" type="java.lang.String" value="..."/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton1ActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JComboBox" name="cRegistryList">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="&#x5b8b;&#x4f53;" size="14" style="0"/>
</Property>
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
<StringArray count="4">
<StringItem index="0" value="Item 1"/>
<StringItem index="1" value="Item 2"/>
<StringItem index="2" value="Item 3"/>
<StringItem index="3" value="Item 4"/>
</StringArray>
</Property>
<Property name="selectedIndex" type="int" value="-1"/>
<Property name="actionCommand" type="java.lang.String" value="comboBoxChanged1"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="cRegistryListActionPerformed"/>
</Events>
<AuxValues>
<AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="&lt;String&gt;"/>
</AuxValues>
</Component>
<Component class="javax.swing.JLabel" name="lblCRegistryMessage">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="&#x5b8b;&#x4f53;" size="14" style="0"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JButton" name="jButton5">
<Properties>
<Property name="text" type="java.lang.String" value="&#x4fdd;&#x5b58;"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton5ActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Container>
<Container class="javax.swing.JPanel" name="javaJPanel">
<AuxValues>
<AuxValue name="JavaCodeGenerator_AddingCodePost" type="java.lang.String" value="javaJPanel.setVisible(false);"/>
</AuxValues>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="8" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="javaSystem" min="-2" max="-2" attributes="0"/>
<Group type="102" alignment="0" attributes="0">
<Component id="javaRegistry" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="javaRegistryList" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" attributes="0">
<EmptySpace min="24" pref="24" max="-2" attributes="0"/>
<Component id="lblJavaRegistryMessage" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Component id="javaSelf" min="-2" max="-2" attributes="0"/>
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
</Group>
<Group type="102" alignment="1" attributes="0">
<EmptySpace pref="23" max="32767" attributes="0"/>
<Component id="jLabel5" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="javaDir" min="-2" pref="216" max="-2" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="jButton3" min="-2" pref="52" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</Group>
<Group type="102" attributes="0">
<Component id="jLabel4" min="-2" pref="131" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
</Group>
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="151" max="-2" attributes="0"/>
<Component id="jButton6" min="-2" max="-2" attributes="0"/>
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="jLabel4" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="12" max="-2" attributes="0"/>
<Component id="javaSystem" min="-2" max="-2" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="javaRegistry" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="javaRegistryList" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="lblJavaRegistryMessage" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="32" max="-2" attributes="0"/>
<Component id="javaSelf" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel5" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="javaDir" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jButton3" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace pref="16" max="32767" attributes="0"/>
<Component id="jButton6" min="-2" pref="34" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JRadioButton" name="javaSystem">
<Properties>
<Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor">
<ComponentRef name="buttonGroup2"/>
</Property>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="&#x5b8b;&#x4f53;" size="14" style="0"/>
</Property>
<Property name="text" type="java.lang.String" value="&#x4f7f;&#x7528;&#x7cfb;&#x7edf;&#x5185;&#x7f6e;&#x7f16;&#x8bd1;&#x5668;"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="javaSystemActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JTextField" name="javaDir">
</Component>
<Component class="javax.swing.JLabel" name="jLabel4">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="&#x5b8b;&#x4f53;" size="16" style="1"/>
</Property>
<Property name="text" type="java.lang.String" value="Java&#x7f16;&#x8bd1;&#x5668;&#x8bbe;&#x7f6e;"/>
</Properties>
</Component>
<Component class="javax.swing.JRadioButton" name="javaSelf">
<Properties>
<Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor">
<ComponentRef name="buttonGroup2"/>
</Property>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="&#x5b8b;&#x4f53;" size="14" style="0"/>
</Property>
<Property name="text" type="java.lang.String" value="&#x6307;&#x5b9a;&#x7f16;&#x8bd1;&#x5668;(javac.exe)&#x6240;&#x5728;&#x6587;&#x4ef6;&#x5939;"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="javaSelfActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JLabel" name="jLabel5">
<Properties>
<Property name="text" type="java.lang.String" value="javac"/>
</Properties>
</Component>
<Component class="javax.swing.JButton" name="jButton3">
<Properties>
<Property name="text" type="java.lang.String" value="..."/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton3ActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JRadioButton" name="javaRegistry">
<Properties>
<Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor">
<ComponentRef name="buttonGroup2"/>
</Property>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="&#x5b8b;&#x4f53;" size="14" style="0"/>
</Property>
<Property name="text" type="java.lang.String" value="&#x4f7f;&#x7528;&#x672c;&#x673a;&#x6ce8;&#x518c;&#x7684;&#x7f16;&#x8bd1;&#x5668;"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="javaRegistryActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JComboBox" name="javaRegistryList">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="&#x5b8b;&#x4f53;" size="14" style="0"/>
</Property>
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
<StringArray count="4">
<StringItem index="0" value="Item 1"/>
<StringItem index="1" value="Item 2"/>
<StringItem index="2" value="Item 3"/>
<StringItem index="3" value="Item 4"/>
</StringArray>
</Property>
<Property name="selectedIndex" type="int" value="-1"/>
<Property name="actionCommand" type="java.lang.String" value="comboBoxChanged2"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="javaRegistryListActionPerformed"/>
</Events>
<AuxValues>
<AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="&lt;String&gt;"/>
</AuxValues>
</Component>
<Component class="javax.swing.JLabel" name="lblJavaRegistryMessage">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="&#x5b8b;&#x4f53;" size="14" style="0"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JButton" name="jButton6">
<Properties>
<Property name="text" type="java.lang.String" value="&#x4fdd;&#x5b58;"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton6ActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Container>
</SubComponents>
</Form>

Binary file not shown.

BIN
Judger/dist/Judger.jar vendored

Binary file not shown.

Binary file not shown.

View File

@ -120,7 +120,7 @@ public class Judger {
} else if (language.equals("java")) { } else if (language.equals("java")) {
compileCommand += "\"" + Config.getCompilerDir(language) + File.separator + "javac\" " + sourceFile; //todoÎļþ·¾ compileCommand += "\"" + Config.getCompilerDir(language) + File.separator + "javac\" " + sourceFile; //todoÎļþ·¾
} else if (language.equals("cpp")||language.equals("c++")) { } else if (language.equals("cpp")||language.equals("c++")) {
compileCommand += "\"" + Config.getCompilerDir(language) + File.separator + "g++\" -Wall -g -std=c++0x -c " compileCommand += "\"" + Config.getCompilerDir(language) + File.separator + "g++\" -Wall -g -std=c++14 -c "
+ "\""+sourceFile+"\"" + " -o " + "\""+Config.getTargetPath()+ File.separator+"output"+ File.separator + "Main"+".o"+"\"\n"; + "\""+sourceFile+"\"" + " -o " + "\""+Config.getTargetPath()+ File.separator+"output"+ File.separator + "Main"+".o"+"\"\n";
} else { } else {
CompileInfo.info = "this programing language is not support!!!"; CompileInfo.info = "this programing language is not support!!!";

View File

@ -64,24 +64,20 @@ public class NewCompileSetting extends javax.swing.JDialog {
private void saveConfig() { private void saveConfig() {
try { try {
//根据radiobutton的选择情况判断写入 //根据radiobutton的选择情况判断写入
if (cSystem.isSelected()) { if (cSystem.isSelected()||cRegistry.isSelected()||cSelf.isSelected()) {
//路径为自带编译器路径 //路径为自带编译器路径
Config.getProp().setProperty(Const.MinGWDir, Config.CompilerDir("c")); Config.getProp().setProperty(Const.MinGWDir, Config.CompilerDir("c"));
Config.getProp().setProperty(Const.MinGWRelative, "1"); Config.getProp().setProperty(Const.MinGWRelative, "1");
} else if (cRegistry.isSelected()) {
Config.getProp().setProperty(Const.MinGWDir, lblCRegistryMessage.getText()); Config.getProp().setProperty(Const.MinGWDir, lblCRegistryMessage.getText());
Config.getProp().setProperty(Const.MinGWRelative, "2"); Config.getProp().setProperty(Const.MinGWRelative, "2");
} else if (cSelf.isSelected()) {
Config.getProp().setProperty(Const.MinGWDir, cDir.getText()); Config.getProp().setProperty(Const.MinGWDir, cDir.getText());
Config.getProp().setProperty(Const.MinGWRelative, "3"); Config.getProp().setProperty(Const.MinGWRelative, "3");
} }
if (javaSystem.isSelected()) { if (javaSystem.isSelected()||javaRegistry.isSelected()||javaSelf.isSelected()) {
Config.getProp().setProperty(Const.JavaCompilerDir, Config.CompilerDir("java")); Config.getProp().setProperty(Const.JavaCompilerDir, Config.CompilerDir("java"));
Config.getProp().setProperty(Const.JavaRelative, "1"); Config.getProp().setProperty(Const.JavaRelative, "1");
} else if (javaRegistry.isSelected()) {
Config.getProp().setProperty(Const.JavaCompilerDir, lblJavaRegistryMessage.getText()); Config.getProp().setProperty(Const.JavaCompilerDir, lblJavaRegistryMessage.getText());
Config.getProp().setProperty(Const.JavaRelative, "2"); Config.getProp().setProperty(Const.JavaRelative, "2");
} else if (javaSelf.isSelected()) {
Config.getProp().setProperty(Const.JavaCompilerDir, javaDir.getText()); Config.getProp().setProperty(Const.JavaCompilerDir, javaDir.getText());
Config.getProp().setProperty(Const.JavaRelative, "3"); Config.getProp().setProperty(Const.JavaRelative, "3");
} }

View File

@ -0,0 +1,3 @@
21:12:38 class java.net.ConnectExceptionConnection timed out: connect
21:12:59 class java.net.ConnectExceptionConnection timed out: connect
21:13:20 class java.net.ConnectExceptionConnection timed out: connect

63
config.xml Normal file
View File

@ -0,0 +1,63 @@
<?xml version="1.0" encoding="utf-8"?>
<languages>
<language id="C++">
<compiler name="MinGW">
<path>K:\Dev-Cpp\MinGW64\bin</path>
<compileCmd>g++.exe -Wall -g -std=c++14 -c $sourceFile$ -o $objFile$</compileCmd>
<!-- g++.exe -Wall -g -std=c++14 -c D:\prog_old\test\main.cpp -o obj\Debug\main.o-->
<linkCmd>g++.exe -o $exeFile$ $objFile$ -O1</linkCmd>
<!-- g++.exe -o bin\Debug\test.exe obj\Debug\main.o -O1-->
<runCmd>"$exeFile$"</runCmd>
</compiler>
<compiler name="MSVC">
<path>C:/MinGW/bin/</path>
<compileCmd>g++.exe -Wall -g -std=c++14 -c $sourceFile$ -o $objFile$</compileCmd>
<!-- g++.exe -Wall -g -std=c++14 -c D:\prog_old\test\main.cpp -o obj\Debug\main.o-->
<linkCmd>g++.exe -o $exeFile$ $objFile$ -O1</linkCmd>
<!-- g++.exe -o bin\Debug\test.exe obj\Debug\main.o -O1-->
<runCmd>msvc</runCmd>
</compiler>
</language>
<language id="Java">
<compiler name="JDK8">
<path>C:/JDK8/bin</path>
<compileCmd>g++.exe -Wall -g -std=c++14 -c $sourceFile$ -o $objFile$</compileCmd>
<!-- g++.exe -Wall -g -std=c++14 -c D:\prog_old\test\main.cpp -o obj\Debug\main.o-->
<linkCmd>g++.exe -o $exeFile$ $objFile$ -O1</linkCmd>
<!-- g++.exe -o bin\Debug\test.exe obj\Debug\main.o -O1-->
<runCmd>"$compilerPath$ java -cp $sourceFile$\output\$exeFile$"</runCmd>
</compiler>
<compiler name="JDK9">
<path>C:/MinGW/bin/</path>
<compileCmd>g++.exe -Wall -g -std=c++14 -c $sourceFile$ -o $objFile$</compileCmd>
<!-- g++.exe -Wall -g -std=c++14 -c D:\prog_old\test\main.cpp -o obj\Debug\main.o-->
<linkCmd>g++.exe -o $exeFile$ $objFile$ -O1</linkCmd>
<!-- g++.exe -o bin\Debug\test.exe obj\Debug\main.o -O1-->
<runCmd>
</runCmd>
</compiler>
</language>
<language id="Python">
<compiler name="Python2">
<path>C:/MinGW/bin/</path>
<compileCmd>g++.exe -Wall -g -std=c++14 -c $sourceFile$ -o $objFile$</compileCmd>
<!-- g++.exe -Wall -g -std=c++14 -c D:\prog_old\test\main.cpp -o obj\Debug\main.o-->
<linkCmd>g++.exe -o $exeFile$ $objFile$ -O1</linkCmd>
<!-- g++.exe -o bin\Debug\test.exe obj\Debug\main.o -O1-->
<runCmd>$exeFile$</runCmd>
</compiler>
<compiler name="Python3">
<path>C:/MinGW/bin/</path>
<compileCmd>g++.exe -Wall -g -std=c++14 -c $sourceFile$ -o $objFile$</compileCmd>
<!-- g++.exe -Wall -g -std=c++14 -c D:\prog_old\test\main.cpp -o obj\Debug\main.o-->
<linkCmd>g++.exe -o $exeFile$ $objFile$ -O1</linkCmd>
<!-- g++.exe -o bin\Debug\test.exe obj\Debug\main.o -O1-->
<runCmd>
</runCmd>
</compiler>
</language>
<!-- sourceFile-->
<!-- objFile-->
<!-- exeFile-->
<language id="VB" />
</languages>