忽略在Java中导入MySQL的空间 [英] Ignore space for importing to MySQL in java

查看:146
本文介绍了忽略在Java中导入MySQL的空间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Java.我有这些JSON数据,彼此之间有2个空格.

I am using java. I have these json data with 2 space each other.

{"created_at":"Mon Jun 01 09:59:50 +0000 2015","id":605312790992056324,"id_str":"605312790992056324"}


{"created_at":"Mon Jun 01 09:59:51 +0000 2015","id":605312794565713920,"id_str":"605312794565713920"}


{"created_at":"Mon Jun 01 09:59:51 +0000 2015","id":605312798445297664,"id_str":"605312798445297664"}


{"created_at":"Mon Jun 01 09:59:53 +0000 2015","id":605312806771146753,"id_str":"605312806771146753"}

然后我导入到MySQL,但是发现了这些问题.我认为它仍然可以连接到db,但无法读取空间.有人知道如何添加代码来应对2空间吗?之前谢谢.对于4个数据来说还可以,但是我有很多数据...

then I import to MySQL but found these problems. It still can connect to db but cannot read space, I think. Anyone know how to add code for cope the 2 space? Thanks before. For 4 data it's okay, but I have a lot of data...

connection sucess
java.io.FileNotFoundException: C:\Users\june1.json (The system cannot find the file specified)
    at java.io.FileInputStream.open(Native Method)
    at java.io.FileInputStream.<init>(FileInputStream.java:138)
    at java.util.Scanner.<init>(Scanner.java:680)
    at java.util.Scanner.<init>(Scanner.java:674)
    at converter.Converter.ReadJSON(Converter.java:30)
    at converter.Converter.main(Converter.java:18)

推荐答案

它正在尝试写入C:/Users/june1.json,由于某种原因,它无法做到这一点. Windows系统目录可能不允许文件(仅允许用户目录.因此,请尝试C:/Users/nizar/june1.json等.

It is trying to write to C:/Users/june1.json and for some reason cannot do that. The Windows system directory may not allow files (but only user directories. So try C:/Users/nizar/june1.json or such.

或者:

File outFile = new File(System.getProperty("user.home") + "/june1.json");

这篇关于忽略在Java中导入MySQL的空间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆