小编Kar*_*aja的帖子

退出javafx程序时如何清理程序?

当我按下窗口右上角的x按钮时,我希望我的JavaFX程序清理程序.我怎样才能做到这一点?清理代码是

        JIntellitype.getInstance().cleanUp();
Run Code Online (Sandbox Code Playgroud)

java user-interface exit-code javafx-2

8
推荐指数
1
解决办法
6746
查看次数

display ='none'在javascript中不起作用

我想隐藏divA并显示divB.如果我单击一个按钮,我想隐藏divB并显示divA.我不想使用JQuery.

当页面加载时,我很难隐藏divA.当我单击按钮时,divB被正确隐藏.

我在文档的开头添加了这个

<script>
    var doNotShow= document.getElementById('divA');
    doNotShow.style.display = 'none';
</script>
Run Code Online (Sandbox Code Playgroud)

问题是,它不起作用.奇怪的是,稍后,我尝试通过按钮点击隐藏divB然后divB隐藏它应该.divA位于文件中的javascript部分之后.

html javascript css

3
推荐指数
1
解决办法
7961
查看次数

将文件在java中上传到ftp服务器时出错

当我尝试将文件上传到ftp服务器时,我收到错误.服务器是远程服务器,但它提供ftp访问.这是我正在使用的代码

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package fileuploaddemo;

import org.apache.commons.net.ftp.FTPClient;
import java.io.FileInputStream;
import java.io.IOException;

public class FileUploadDemo {
public static void main(String[] args) {
    FTPClient client = new FTPClient();
    FileInputStream fis = null;

    try {
        client.connect("ftp.adress.comlu.com");
        client.login("username", "mypass");

        //
        // Create an InputStream of the file to be uploaded
        //
        String filename = "D:/xxx/screen0.png";
        fis = new FileInputStream(filename);

        //
        // Store file to server
        //
        client.storeFile(filename, …
Run Code Online (Sandbox Code Playgroud)

java file-upload image-upload java-server

2
推荐指数
1
解决办法
8174
查看次数

在java应用程序中使用ftp4j库下载/上载时出现FTP错误

我想在java应用程序中下载一个文件,当我尝试它时,它会在我的硬盘驱动器上创建该文件但无法完全下载它.我正在使用ftp4j库来做到这一点.

import it.sauronsoftware.ftp4j.*;
public class Main {
public static void main (String args[]){
    FTPClient client = new FTPClient();
    try{
    client.connect("ftp.myaddress.comlu.com");
    client.login("username", "password");
    System.out.println("Connection created");
    client.download("public_html/ZScreen.png", new java.io.File("d:/xxx/ZScreen.png"));
    System.out.println("Download successful");
    client.disconnect(true);
    }
    catch (Exception FTPException){
    System.out.println("Shit hit the fan");
    }
}
}
Run Code Online (Sandbox Code Playgroud)

我总是创建Connection并且Shit击中粉丝.此外,我的硬盘驱动器上创建了一个文件,但它的大小为0字节.

这是堆栈竞赛

Connection created
java.net.SocketException: Connection reset
Shit hit the fan
at java.net.SocketInputStream.read(SocketInputStream.java:189)
at java.net.SocketInputStream.read(SocketInputStream.java:121)
at sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:283)
at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:325)
at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:177)
at sun.nio.cs.StreamDecoder.read0(StreamDecoder.java:126)
at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:112)
at java.io.InputStreamReader.read(InputStreamReader.java:168)
at it.sauronsoftware.ftp4j.NVTASCIIReader.readLine(NVTASCIIReader.java:105)
at     it.sauronsoftware.ftp4j.FTPCommunicationChannel.read(FTPCommunicationChannel.java:142)
at it.sauronsoftware.ftp4j.FTPCommunicationChannel.readFTPReply(FTPCommunicationChannel.java:187)
at it.sauronsoftware.ftp4j.FTPClient.openPassiveDataTransferChannel(FTPClient.java:3538)
at it.sauronsoftware.ftp4j.FTPClient.openDataTransferChannel(FTPClient.java:3473)
at it.sauronsoftware.ftp4j.FTPClient.download(FTPClient.java:3302) …
Run Code Online (Sandbox Code Playgroud)

java ftp ftp-client ftp4j

1
推荐指数
1
解决办法
4465
查看次数