我不知道如何添加依赖项。我的模块需要Log4j。我在模块信息中添加了要求。我还添加了gradle依赖项。我可以运行项目,但不能创建自定义运行时映像。
plugins {
id 'java'
id 'application'
id 'org.openjfx.javafxplugin' version '0.0.5'
}
group 'eu.sample'
version '2.0'
repositories {
mavenCentral()
}
javafx {
modules = [ 'javafx.controls', 'javafx.fxml' ]
}
mainClassName = "$moduleName/eu.sample.app.Main"
def lin_java_home = hasProperty('org.gradle.java.home') ? getProperty('org.gradle.java.home') : System.getenv('JAVA_HOME')
def lin_fx_jmods = hasProperty('linux.fx.mods') ? getProperty('linux.fx.mods') : System.getenv('PATH_TO_FX_MODS_LIN')
def win_java_home = hasProperty('windows.java.home') ? getProperty('windows.java.home') : System.getenv('JAVA_HOME_WIN')
def win_fx_jmods = hasProperty('windows.fx.mods') ? getProperty('windows.fx.mods') : System.getenv('PATH_TO_FX_MODS_WIN')
dependencies {
compile group: 'org.apache.logging.log4j', name: 'log4j-core', version: '2.11.1'
}
task jlink(type: Exec) {
dependsOn 'clean' …Run Code Online (Sandbox Code Playgroud) 我在解决方案中添加了图片。将编译操作属性更改为资源,并且不进行复制。第一次运行检查中的应用程序是目录和文件(如果未创建)是否存在。我的应用程序需要对象的默认图像。因此,这就是我在解决方案中添加图像的原因。现在如何将其复制到特定的磁盘位置。
我是根据自己创建的样本写的。
if (!File.Exists(path_exe + "\\images\\drinks\\defaultIMG.jpg"))
{
using (var resource = Assembly.GetExecutingAssembly().GetManifestResourceStream("Data\\defaultIMG.jpg"))
{
using (var file = new FileStream(path_exe + "\\images\\drinks\\defaultIMG.jpg", FileMode.Create, FileAccess.Write))
{
resource.CopyTo(file);
}
}
Run Code Online (Sandbox Code Playgroud)
}
但这只会创建空文件。
public class kDrinki
{
public int id {get; set;}
public string nazwa { get; set; }
public string skladniki { get; set; }
public string opis { get; set; }
public string sciezka { get; set; }
public kDrinki(int _id, string _nazwa, string _skladniki, string _opis, string _sciezka)
{
id = _id;
nazwa = _nazwa;
skladniki = _skladniki;
opis = _opis;
sciezka = _sciezka;
}
}
Run Code Online (Sandbox Code Playgroud)
我有那门课.我创建了对象的List lst_pDrinkow并添加了一些表单XML.我不知道如何从列表中只找到单个对象(使用对象id而不是列表id)并编辑他的所有数据(不仅仅是单个参数).